douaonong7807 2015-02-23 21:52
浏览 47

打破PHP代码执行并继续下一个请求| 多请求服务器端代码执行

Is it possible to make php code execution to break at a certain command, end the http connection, than "wait" for the client to request the page again and continue from that point but with new $_POST or $_GET content?

I don't think php offers such a thing because it's hard to make sure the second request comes from the same client.

The usage should be for controlling a simple device over the internet by a program running on the server. The device just recieves some simple commands from the server like forward or turn_left and responds with statements like success or turning_failed. But to be able to run the complex code on the server I need the ability to get feedback from the device.

And because the code is complex, I can't have simple solution like indexing the requests or something like that. The "break" command could be inside another function and/or inside a loop...

So the only solution I came up with is to make my own interpreter written in php, which would be able to break execution like required and save all states to a file and later on continue from that point.

So my question should be: Do you know such a sophisticated interpreter? (language doesn't matter - c#, lua, js, ...) It would take a long time to make my own so I want to know all options.

Btw, php generators look really nice to me but they are iterable only in foreach loop not in forsomerequest loop :D

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大