Home  >  Article  >  Backend Development  >  PHP 命令行参数

PHP 命令行参数

WBOY
WBOYOriginal
2016-06-23 14:29:081047browse

                  <p class="sycode">                 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'])保存着参数的数量                  </p>

Statement:
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