Introduction: This is a detailed page of the PHP getopt function. It introduces the related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 336873 'rolling = 'no'>
Short Parameters
It returns an array containing command line parameters. For example, to obtain the values of-a-B and-C, you can do this:
$ Arguments = getopt ("A: B: C :");
You can run the script in the following way (it does not matter whether there are spaces. Check the first and second examples ):
PHP test. php-A app-B bar-C carorphp test. php-AAPP-bbar-ccar
Print_r ($ arguments) will return:
Array ([a] => app [B] => bar [c] => Car)
Note:
1. colon is required
2. If no value is specified, it will not appear in the array.
Or the example just now:
PHP test. php-A app
Print_r ($ arguments ):
Array ([a] => APP)
About long parameters
If you use a long parameter (-- name = value or -- name value) earlier than PhP 5.3, the following error message may be obtained:
PHP warning: getopt (): no support for Long Options in this build in...
Therefore, it is best to use short parameters If PHP versions are earlier than 5.3.
More articles about "php getopt function"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/336873.html pageno: 9.