PHP command line parameter details and applications

  • 2020-05-07 19:18:29
  • OfStack


#  Execution format with no parameters  
php The installation directory /bin/php scriptname.php 
#  Execution format with parameters  
php The installation directory /bin/php scriptname.php [ parameter 1] [ parameter 2] ..... 
 in scriptname.php through $argv and $argc To access parameters  
# $argv( Formal writing $_SERVER['argv']) The array holds all of the passed arguments 1 A parameter $argv[0] / $_SERVER['argv'][0]  For the name of the executed script, such as,  scriptname.php 
# $argc( Formal writing $_SERVER['argc']) Holds the number of parameters 
 

When the user opens the php page, the server executes the PHP command and sends the execution results to the user's browser, similar to ASP and CoildFusion. PHP runs on WINDOWS and various versions of UNIX. In addition to being able to manipulate your page, PHP can also send HTTP titles.
You can set up cookie, manage digital signatures and redirect users, and it provides excellent connectivity to other databases (as well as ODBC), integrating various external libraries to do whatever it takes to parse XML with PDF documents. Did you know you could do something else with the power of php? When running in a standalone cgi mode, you need an php executable. It has a lot of command-line arguments, some of which can be used for fun. < > The list is definitely 1. Usage php [-q] [-h] [-s] [-v] [-i] [-f] | {[args...] } -q quiet mode. No HTTP header is output.
-s converts php program files to color HTML(e.g. reserved words in green, functions and variables in blue, comments in yellow and strings in red, etc.).
-f reads and interprets the specified file.
-c reads in the php.ini file
-a interactive run
-d foo[=bar] defines the value of the input item foo in ini as bar
-e outputs additional information for debugging and performance analysis
-z brings up Zend extension file
- information about i php
-h help itself.
1. Use php-q filename.php to use php as shell,
2. html your php program with -s. Isn't that easy?
3. Use php's odbc function to operate the database in shell command.

Related articles: