我在我的系统上使用WAMP服务器来执行php脚本。
我想从我的主脚本test.php
执行脚本main.php
。
为此,我使用exec
函数,例如exec('php test.php');
。在test.php
中,我发了一个echo
声明。
但是当我从浏览器运行main.php
脚本时,我无法看到test.php
脚本的输出。
我做错了什么?请建议。
答案 0 :(得分:2)
您必须提供php.exe
exec("c:\wamp\<where ever you exe is>/php.exe test.php");
所以它必须是一条正确的道路
答案 1 :(得分:1)
使用此命令
echo exec('php test.php', $output); //this will print your echo statement.
print_r($output);