dongxieting9623 2018-05-20 22:16
浏览 141
已采纳

从Windows 10 XAMPP执行PHP CLI脚本时未定义$ argv

I'm attempting to execute a PHP script from the command line in Windows 10 while using XAMPP for localhost.

From the Git terminal application on Windows 10, I'm running the following command:

/c/xampp/php/php.exe /path/to/script/script.php arg1=val1

The script executes correctly, but when I try to do the following:

print_r($argv);

I get the following error:

PHP Notice:  Undefined variable: argv in /path/to/script/script.php on line line-#.

Also, php_sapi_name() returns cli, so I should be good, but both $argv and $argc return as undefined.

Does anyone know why? Thanks.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 使用DWY100k数据集对UEA进行测试,出现报错:IndexError: index 125000 is out of bounds for axis 0 with size 95500
      • ¥15 前端vue实现根据图片url生成pdf文件
      • ¥15 RfidReader资源Q个
      • ¥20 user-agent是否是唯一的,有没有可能相同
      • ¥15 关于#开会#的问题,如何解决?(语言-c++)
      • ¥15 关于#二十四点问题#的问题
      • ¥15 运行kitex的demon出错(求大家解决)
      • ¥15 开发一个类似 typora 这样的软件需要多少钱?
      • ¥15 clearcase7.0安装包
      • ¥15 断点回归模型月度核密度检验不连续