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/] #