English 中文(简体)
通过与现状更新的网络链接跟踪PHP batch
原标题:Running PHP batch scripts through web link with status updates

我在一份分批文件中确定了一个过程,它有3个文件,一个文件按顺序排列,我希望为这一进程建立一个网络前端。 当有人用网络格式上载一个文件时,就会启动这一过程。

我希望能够在每份剪辑档案中打字之后向用户发出通知,但我并不确信,正确的道路是什么。

I am thinking in terms of javascript that sends request to the 3 php files in sequence, with the php scripts echoing the status messages as they are executed. But I would rather have the three files executed in a single trigger from the client instead of having javascript calling the the three scripts separately.

任何想法是怎样才能做到的?

最佳回答

You could create a single php file that runs the 3 php script and echoes their ouputs. By executing a server side request trough AJAX (I suggest jQuery framework) the outputs may be collected and the client side scripts can process and show the results to the user.

问题回答

Store messages in the database or other centralized storage system. Use an ajax call to pull the newest messages.

在服务器上安装一个Ajax电话。 您没有具体说明贵国的网址的文字如何运行,但我要做的是包括其他的网址(这些档案将具有处理它们本应做的事情的职能),然后从主要档案中称这些功能。 这些职能应当归还你可以收集的一系列成功/反复的信息。 类似情况:

$response[] = firstFileProcessing(); //your function names should be better
$response[] = secondFileProcessing();
$response[] = thirdFileProcessing();

When all the scripts are done processing, do:

echo json_encode(array("responses" => $response));

Then back in your success function for the ajax call, you d do:

var res = jQuery.parseJSON(response_from_server); 
//or if you told ajax to expect a json response, 
//response_from_server would automatically be an object based on the json sent

and step through each one to see what php said.

alert(res.responses[0]); //the first file said this

或者,你可以更详细地从综合系统收取费用——这是自己的一系列费用,其数额为:响应费用[成功]=交易收入,费用[收益]=“工作”——任何数据。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签