简体   繁体   中英

execute PHP script and get an update of process

I need to write a script in PHP that read a list of XML and convert them in a text file

I will add a button in my page that triggers

exec("xml2csv.php");

since i can have a lot of them i would like to give user feedback on process update, it can be a text feedback

kind of like javascript image upload with % update

i'm not sure is possible and how to proceed

Provided you know the number of lines or bytes of XML you must parse, have your PHP script write to a file on the server the number of bytes (or lines) it has completed writing periodically throughout the scripts execution using file_put_contents() .

On the client side, using AJAX, poll the server for the contents of this file and display this result to the user every x seconds. Using jQuery's $.POST would be good for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM