Execute the $ argv and $ argc configuration methods in the php script through the command line, argvargc
In actual work, you may encounter the need to execute a php script in the nginx command line. Of course, you can configure a conf file for Internet access.
Use
php index.php
You can execute this index. php script, but how to pass the parameter? $ Argv and $ aegc will be used. You do not need to enable any settings and use them directly in the script, similar to $ _ POST and $ _ GET. In http values ..
Insert the following dish in index. php?
<?phpecho $argv[0]; echo "\n";var_dump($argv[1]); echo "\n";var_dump(intval($argv[2])); echo "\n";echo $argv[3]; echo "\n";echo $argc;
Then use
php index.php 1 10 100
Display
Index. php // $ argv [0]: The result is tested. This shows the relative path of the script relative to the execution location (where do you enter the php index. php. The index is displayed here. php relative to the location of your current directory) string (1) "1" // $ argv [1] shows that the first parameter is converted into a string int (10) // $ argv [2] shows the second parameter 100 // $ argv [3] shows the relative path of the second parameter 4 // $ argv parameter + the parameter you passed
For convenience of memorizing this variable$ Avgv is an argument vector, and $ avgc is an argument count
Details:
Http://php.net/manual/zh/reserved.variables.argv.php#93532
Summary
The above section describes how to execute $ argv and $ argc in the php script through a command line. I hope it will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!