Introduction: This is the PHP getopt function of the detailed page, introduced and PHP, related knowledge, skills, experience, and some PHP source code and so on.
class= ' pingjiaf ' frameborder= ' 0 ' src= ' http://biancheng.dnbcw.info/pingjia.php?id=336873 ' scrolling= ' no ' > Short parameters
It returns an array containing command-line arguments. For example, to get the value of-a-b and-C, you can do this:
$arguments = getopt ("A:B:C:");
You can run the script in the following way (there are no spaces are not related, note the first example and the second example):
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)
Attention:
1. The colon is required
2. If no value is specified, it will not appear in the array
Or just the example:
PHP test.php-a App
Print_r ($arguments):
Array ( [a] + = app)
About Long parameters
Earlier than PHP 5.3, if you use a long parameter (--name=value or--name value), you will probably get the following error message:
PHP warning:getopt (): No support for long options in the This build in ...
Therefore, it is best to use short parameters if the PHP version is earlier than 5.3.
More articles on "PHP getopt functions"
Love EE focus on Java Michael Jackson Video station JSON online tool
Http://biancheng.dnbcw.info/php/336873.html Pageno:9