dongtuo3370 2018-11-21 14:16
浏览 32

通过PHP启动.php脚本异步并回答请求

I try to start a .php script asynchron from an other php script.

if (substr(php_uname(), 0, 7) == "Windows"){
    $cmd = "start /B php AsynchronDownload.php fileids=".$this->header->queryParams['ids'] . " uid=".$this->header->tokenData->uId . " groupId=".$this->header->tokenData->groupId . " timestamp=".$this->header->tokenData->timestamp . " state=".$this->header->tokenData->state. " token=".$this->header->tokenData->token;
    pclose(popen($cmd, "r")); 
} else {
    $cmd = "/usr/bin/php7.2-cli AsynchronDownload.php fileids=".$this->header->queryParams['ids'] . " uid=".$this->header->tokenData->uId . " groupId=".$this->header->tokenData->groupId . " timestamp=".$this->header->tokenData->timestamp . " state=".$this->header->tokenData->state. " token=".$this->header->tokenData->token;
    exec($cmd . " > /dev/null &");
}

Thats work fine. But is it possible to awnser to an Http Request, how is send to the first skript from a client in the second asynchron started skript? I found out the details about the Request are not available on the second skript.

If I try to set Headers for the Response with (for example) header('Content-type: x-zip') they are not set. headers_list() funktion returning NULL.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 c程序不知道为什么得不到结果
    • ¥40 复杂的限制性的商函数处理
    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置