Php Command Line usage and command line parameters

Source: Internet
Author: User
This article mainly introduces the php Command Line usage and command line parameter descriptions. For more information, see

This article mainly introduces the php Command Line usage and command line parameter descriptions. For more information, see

The Code is as follows:


[Root @ localhost/] #
[Root @ localhost/] # php-r "var_dump (true);" # PHP code execution is not required Tag
Bool (true)
[Root @ localhost/] # php-R "var_dump (true);" # execute every input line of PHP code

Bool (true)

Bool (true)

Bool (true)
[Root @ localhost/] #
[Root @ localhost/] # php-f "file" # execute the php code from the file
[Root @ localhost/] #
[Root @ localhost/] # php "test. php" id name sex
Int (4)
Array
(
[0] => test. php
[1] => id
[2] => name
[3] => sex
)
[Root @ localhost/] #
[Root @ localhost/] # cat test. php

Var_dump ($ _ SERVER ["argc"]); // gets the number of parameters passed in by the command line.
Print_r ($ _ SERVER ["argv"]); // gets the array of input parameters from the command line.

[Root @ localhost/] #

,

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.