繁体   English   中英

如何在php exec()中传递参数?

[英]How to pass arguments in php exec()?

我正在尝试使用输入文件和参数运行.exe应用程序。

使用cmd我可以像这样成功启动可执行文件...

C:\Program Files\MyApp.exe "path\to\input file" argument

但是,当我像这样简单地将上面的字符串复制粘贴到exec()函数中时,什么也没有发生。

exec("C:\Program Files\MyApp.exe "path\to\input file" argument") 

我是否需要转义字符串的一部分? 我应该如何进行?

就像通过shell正常调用一样传递参数

例如:

exec("C:\Program Files\MyApp.exe \"path to\input file\" argument") 

我不得不使用这种格式

php -q "./yii.php" migrate/up --interactive=0 --migrationPath=@vendor/pheme/yii2-settings/migrations

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM