Analysis of the application of argc argv in PHP _php tutorial

Source: Internet
Author: User
Tags first string
ARGC,ARGV useful when compiling programs with the command line
We will find such parameters in the timed 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 timed task above, if we call him with the parameter $argv[1], that means the first string in the script that executes the program name on the DOS command line
That corresponds to the Red 1 in the script above, 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 that this task is divided into three processes running, that is to say, the pressure into the original One-third, so it is easy to understand

The official explanations for these two keywords are released below.
ARGC: Integer that counts the number of command-line arguments sent to the main function when you run the program
* argv: An array of strings to hold an array of pointers to your string arguments, each of which points to a parameter
ARGV[0] Full path name to program run
ARGV[1] point to the first string after executing the program name on the DOS command line
ARGV[2] Pointer to the second string after the name of the executing program
ARGV[ARGC] is null

http://www.bkjia.com/PHPjc/327799.html www.bkjia.com true http://www.bkjia.com/PHPjc/327799.html techarticle argc,argv Useful when compiling a program with the command line we will find such parameters in the timed task script, $obj-run ($argv [1]); */30 * * * */usr/local/bin/php/htdocs/test.com/uaqm/ Comma ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.