* PHP CLI mode
* Cli:command lines Interface (command line interface)
* PHP can be used in addition to the Apache IIS server, can also be run through the CLI mode, because PHP is essentially written in C language program
* The following are common PHP CLI commands
* in console input OH:
Php-v Show PHP version
--ini output php.ini configuration file information
--rf function <name> output PHP functions, including parameters of functions
--ri <extension> output PHP extension information
-I output PHP details, a lot of content, equivalent to Phpinfo ();
-m output compiled module
--re output PHP extension information, package block the corresponding function of this module, the constants defined in this extension
Run the PHP program in CLI mode
Create a new cli.php file
The first line is entered:
#! C:\php\php.exe-q
This command indicates that this is a CLI program
After entering PHP tags
<?php
echo "Hello php cli";
?>
Then enter Php.exe cli.php in the command line mode
The complete program is as follows
[PHP]View PlainCopy print?
- #! C:\php\php.exe-q
- <?php
- echo ' Hello php cli ';
- ?>
Using the CLI method to transmit the parameter
PHP passes parameters via $_server[' argc ' and $_server[' argc ']
The passed parameter is daiyutage 22
[PHP]View PlainCopyprint?
- #! C:\php\php.exe-q
- <?php
- echo "Hello php cli\n";
- Var_dump ($_server[' argc '); //$_server[' argc ') is the number of arguments passed
- Var_dump ($_server[' argv '); //s_server[' argv ') is the value of the passed parameter, expressed as an array
- ?>
Note: When the Apache server passes the Web page to the PHP interpreter for data submitted to the server, it is passed through environment variables, and some PHP default global variables are initialized after the PHP process is started.
After running the environment, the system gives the PHP global variables to be set, all PHP can be used directly.
Source: http://blog.csdn.net/daiyutage/article/details/48999129
PHP CLI mode in a detailed