$argv: 以数组形式接收保存参数
$argc:保存参数个数
<?php
echo "接收到{$argc}个参数";
print_r($argv);
//执行
//php /usr/local/php/bin/php test.php
接收到1个参数Array
(
[0] => test.php
)
// php /usr/local/php/bin/php test.php a b c d
接收到5个参数Array
(
[0] => test.php
[1] => a
[2] => b
[3] => c
[4] => d
)
<?php
$param_arr = getopt('a:b:');
print_r($param_arr);
php /usr/local/php/bin/php test.php -a 345 -b 12q3
Array
(
[a] => 345
[b] => 12q3
)
<?php
fwrite(STDOUT,'请输入您的博客名:');
echo '您输入的信息是:'.fgets(STDIN);
// php /usr/local/php/bin/php test.php
请输入您的博客名:test
您输入的信息是:test