I think you can set up environment variables to do that, for example, if you are using Microsoft Windows, tryc:\>set a=100
c:\>php test.phpor you can add this line to your code:
$a=$argv[1];then do
c:\>php test.php 100
c:\>php test.phpor you can add this line to your code:
$a=$argv[1];then do
c:\>php test.php 100
'argv'
Array of arguments passed to the script. When the script is run on the command line, this gives C-style access to the command line parameters. When called via the GET method, this will contain the query string.
'argc'
Contains the number of command line parameters passed to the script (if run on the command line).
命令:
x:\phpPath\php test.php arg1 arg2 arg3test.php是第0个参数
test.php:
<?
echo $argc."个参数\n";
print_r($argv);
?>
我做了一个简单的WEB服务器,想做成能支持PHP脚本的,接口是自怎样的呀,
另发一帖啦??
这样好像不对呀
http://php.libero.it/manual/en/features.commandline.phpyou should do php a.php "&a=100"anyone confirm? (I don't have PHP)