The php command parameter www. php. netmanualzhfeatures. commandline. php-f -- file parses and runs the file name specified by the-f option. This parameter is optional and can be omitted. it only specifies the name of the file to be run. The following command line mode option parameters are provided by the PHP binary file (namely, the php.exe program). you can use the php-h PHP command parameters at any time.
Http://www.php.net/manual/zh/features.commandline.php
-F -- file parses and runs the file name specified by the-f option. This parameter is optional and can be omitted. it only specifies the name of the file to be run.
The following are the command line mode option parameters provided by the PHP binary file (php.exe program). you can use the PHP-h command to query these parameters at any time.
Usage: php [options] [-f] [args...]
Php [options]-r DE> [args...] DE>
Php [options] [-- args...]
-S Display color syntax highlighted source.
-W Display source with stripped comments and whitespace.
-F Parse.
-V Version number
-C | Look for php. ini file in this directory
-A Run interactively
-D foo [= bar] Define INI entry foo with value 'bar'
-E Generate extended information for debugger/profiler
-Z Load Zend extension.
-L Syntax check only (lint)
-M Show compiled in modules
-I PHP information
-R DE> Run php de> without using script tags DE>
-H This help
Args... Arguments passed to script. Use -- args when first argument
Starts with-or script is read from stdin
The cli sapi module has the following three methods to obtain the PHP code you want to run:
1.
Run the specified file in PHP.
Php my_script.php
Php-f my_script.php
The above two methods (using or without the-f parameter) can run the given my_script.php file. You can select any file to run the script. the PHP script you specified does not have to use. php as the extension. they can have any file name and extension.
2.
Run the PHP code directly on the command line.
Php-r 'print _ r (get_defined_constants ());'
When using this method, pay attention to the substitution of shell variables and the use of quotation marks.
Note: read the preceding example carefully. there is no start or end mark when running the code! After the-r parameter is added, these tokens are not required, and adding them will lead to syntax errors.
3.
Provide the PHP code to be run through standard input (stdin.
The above usage provides us with very powerful functions, so that we can dynamically generate PHP code and run the code through the command line as follows:
$ Some_application | some_filter | php | sort-u> final_output.txt
The preceding three methods for running code cannot be used at the same time.