如何在CL中使用参数执行php文件,而不是使用浏览器


how to execute a php file in CL with an argument instead of using the browser.

我正在通过web浏览器执行php文件,但我曾经在linux命令行中运行它:

php phpfile.php

现在我必须使用浏览器来执行文件因为我必须传递这样的参数:

localhost/mywebsite/phpfile.php?argument=false

还可以在命令行中执行吗?

php -f somefile.php a=1 b[]=2 b[]=3

见http://php.net/manual/en/features.commandline.php

希望这对你有帮助!