[英]Submit -> Execute PHP script -> Alert User — while staying on same page
[英]Execute shell script in the background while a page is displayed on screen to the user in php
在我的应用程序中,我正在运行Shell脚本,但是直到脚本执行完毕,屏幕才变成空白。 我无法在屏幕上显示任何内容。 我想向用户显示日志文件,因此在生成日志文件之前,我希望用户在屏幕上看到一些文本内容。
我读了以前的问题,他们说不可能在php中进行多线程。
有办法可以做到吗?
这两个问题可能会有所帮助:
1> exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));
我会使用jQuery。
调用该页面从主页加载php脚本。
链接到jQuery.get(): http ://api.jquery.com/jQuery.get/
这些问题表明是否可行,取决于您所看的是谁的答案。 PHP中的多线程
你应该看看; http://joseph.randomnetworks.com/2005/10/21/fake-fork-in-php/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.