Home>Article>Backend Development> Examples of writing shell commands on the php command line
The content of this article is about writing shell commands on the PHP command line. The content is very detailed. Friends in need can refer to it. I hope it can help you.
php can run like java perl python. Today I discovered that if I had known this earlier, maybe I would not have learned java and python
I learned java back then just to put a program on the server. After running and running, it turns out that php can also be used.
php -h Usage: php [options] [-f][--] [args...] php [options] -r [--] [args...] php [options] [-B
] -R [-E
] [--] [args...] php [options] [-B ] -F [-E ] [--] [args...] php [options] -S : [-t docroot] [router] php [options] -- [args...] php [options] -a -a Run as interactive shell -c | Look for php.ini file in this directory -n No configuration (ini) files will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -f Parse and execute . -h This help -i PHP information -l Syntax check only (lint) -m Show compiled in modules -r Run PHP
without using script tags ..?> -B
Run PHP before processing input lines -R Run PHP
for every input line -F
Parse and execute for every input line -E Run PHP after processing all input lines -H Hide any passed arguments from external tools. -S : Run with built-in web server. -t Specify document root for built-in web server. -s Output HTML syntax highlighted source. -v Version number -w Output source with stripped comments and whitespace. -z Load Zend extension . args... Arguments passed to script. Use -- args when first argument starts with - or script is read from stdin --ini Show configuration file names --rf Show information about function . --rc Show information about class . --re Show information about extension . --rz Show information about Zend extension . --ri Show configuration for extension .
1. Use the php command line to execute the php script, such as /usr/bin/php test.php
Abbreviationphp test.php
test.php
2. Write #!/usr/ on the first line at the beginning of the script bin/php, and then you can set the script to be executable chmod a
Execute for an hour and see if php will hang. I hope that a command line can run forever
#!/usr/bin/php
##3. External incoming parameters
#!/usr/bin/phpRelated recommendations:
How to use OSS to code in ThinkPHP3 Writing
How to use php code to implement seal cutout (code)The above is the detailed content of Examples of writing shell commands on the php command line. For more information, please follow other related articles on the PHP Chinese website!