- 接收参数
function adds(){
$args = func_get_args();
$n = func_num_args();
dump($args);
}
adds(1,2,3,4);
php task.php -i 2
getopt("i:") 返回数组 ["i"] 推荐方式
$argc 是参数个数
$argv 数组,0是文件名1是参数-i 2是值2
- 宝塔定时任务,后面是传递参数
cd /www/
php task.php -i 2
php -S localhost:8000 自带服务器命令启动
文档更新时间: 2020-07-23 19:47 作者:Yoby