This article mainly introduces the command line to execute PHP script $argv and $ARGC methods, this article gives you a very detailed introduction, the need for friends can refer to, hope to help everyone.
In the actual work may encounter the need to execute PHP script in the Nginx command line, of course, you can configure a conf to use the external network access.
Use in the Nginx command line
php index.php
You can execute the index.php script, but how do you pass the parameters? That will use $ARGV and $AEGC. You do not have to turn on what settings are used directly in the script, similar to HTTP $_post and $_get in the value of the pass:
Do you want to insert the following dishes 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;
And then use it on the Nginx command line.
PHP index.php 1 10 100
Show
index.php//$ARGV [0] Display results tested here is the relative path to the execution position (that is, where you entered the PHP index.php, which shows the location of index.php relative to your current directory) string (1) "1" $ARGV [1] shows that the first parameter will be converted to a string int (ten)//$ARGV [2] Display the second parameter of [+//$ARGV [3] shows the second parameter 4//$ARGV the number of parameters relative to the path + you pass the Parameters
For the sake of memory, check this variable.$avgv 为 argument vector, $avgc 为 argument count