Home  >  Article  >  Backend Development  >  PHP command line usage and command line parameter description_PHP tutorial

PHP command line usage and command line parameter description_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:34:32795browse

Copy code The code is as follows:

[root@localhost /]#
[root@localhost /]# php -r "var_dump(true);" # Executing PHP code does not require tag
bool(true)
[root@localhost /]# php -R "var_dump(true );" # Execute each input line of PHP code

bool(true)

bool(true)

bool(true)
[root@localhost /] #
[root@localhost /]# php -f "file" # Execute php code from 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"]); // Get the number of parameters passed in from the command line
print_r($_SERVER["argv"]); // Get the array of parameters passed in from the command line

[root@localhost /]#

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/750860.htmlTechArticleCopy the code as follows: [root@localhost /]# [root@localhost /]# php -r "var_dump (true);" # No need to execute PHP code?php... ? Tag bool(true) [root@localhost /]# php -R "var...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn