0

您好,我想问一下如何执行exec()不在我网站上的外部 php 脚本它是否像这样工作?

exec("php http://site.com/executor.php?something=1&something2=A");
4

1 回答 1

1

不,因为当使用 HTTP 时,远程服务器会发送 PHP 脚本的结果。正因为如此,该命令不支持 URL。如果要在远程服务器上执行代码,则需要访问 PHP 文件本身。如果你只需要结果,你可以使用例如

readfile("http://site.com/executor.php?something=1&something2=A")

或从 URL 读取的其他方式(fopenfread、、file_get_contents... file)。

于 2013-06-09T09:53:48.057 回答