PHP 命令行参数

WBOY
Release: 2016-06-23 14:29:08
Original
1014 people have browsed it

php除了可以在web上执行,还可以通过PHP CLI(命令行界面)在命令行执行PHP脚本 # 不带参数的执行格式 php安装目录 / bin / php scriptname . php # 带参数的执行格式 php安装目录 / bin / php scriptname . php [参数1] [参数2] ..... 在scriptname . php通过 $argv和$argc访问参数 # $argv(正式写法$_SERVER['argv'])数组保存着传递的全部参数,需要注意的是第一个参数$argv[0] / $_SERVER['argv'][0] 为执行脚本的名称如, scriptname.php # $argc(正式写法$_SERVER['argc'])保存着参数的数量

Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!