【问题标题】:How to exec external script如何执行外部脚本
【发布时间】:2013-06-09 09:46:52
【问题描述】:

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

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

【问题讨论】:

标签: php exec external


【解决方案1】:

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

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

或从 URL 读取的其他方式(fopenfreadfile_get_contentsfile...)。

【讨论】:

    猜你喜欢
    • 2019-10-28
    • 1970-01-01
    • 2012-11-13
    • 2017-06-09
    • 2017-10-19
    • 2013-07-01
    • 2015-03-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多