1.$argc
传给脚本的参数的个数,最小值为1.
<?php
var_dump($argc);
var_dump($argv);
2.$argv
3.getopt
$options = getopt('f:hp::');
h // 没写,为空,写了没传值,为false。写了传值了,还是为 false
f: // 没写,为空。写了没传值,为空。写了传值了,为值
p:: // 没写,为空 。 写了没传值,为false。传了为实际值
<?php
$shortopts = '';
$shortopts .= 'f:';
$shortopts .= 'v::';
$shortopts .= 'abc';
$longopts = array(
'required:',
'optional::',
'option',
'opt',
);
$options = getopt($shortopts,$longopts);
var_dump($options);
http://www.cnblogs.com/zcy_soft/archive/2011/06/29/2093597.html