argc, argv are useful when compiling programs from the command line
We will find such parameters in the scheduled task script, $obj->run($argv[1]);
*/30 * * * * /usr/local/bin/php /htdocs/test.com/uaqm/commands/test.php 1 >/dev/null 2>&1
Just like the scheduled task above, If we add the parameter $argv[1] when calling him, it means that the first string
after the program name is executed on the DOS command line in the script is the corresponding red string in the above script. That 1, if we deploy the scheduled tasks listed below
*/30 * * * * /usr/local/bin/php /htdocs/test.com/uaqm/commands/test.php 1 >/dev /null 2>&1
*/30 * * * * /usr/local/bin/php /htdocs/test.com/uaqm/commands/test.php 2 >/dev/null 2>&1
*/30 * * * * /usr/local/bin/php /htdocs/test.com/uaqm/commands/test.php 3 >/dev/null 2>&1
Then we think this task is divided into three A process is running, which means that the pressure becomes one-third of the original, so it is easy to understand
The official explanations of these two keywords are released below.
argc: integer, used to count the number of command line parameters sent to the main function when you run the program
* argv: string array, used to store an array of pointers pointing to your string parameters , each element points to a parameter
argv[0] points to the full path name of the program running
argv[1] points to the first string after the program name is executed on the DOS command line
argv[2 ] Points to the second string
after the execution program name argv[argc] is NULL