简体   繁体   中英

Redirecting the page to another html script and execute php script in background

i have a requirement in which user need to upload a file and click on submit after uploading the page. after clicking on submit a php script runs in the background. what i want is that the page should be redirected to another PHP page while script.php script should execute in the background.

<form action=script.php method='POST'> 

what i want is that the script.php script should still run and the page should be redirected to some result.html page.. Any idea?

as fare as I understood your question you need a message queue tool. save the requests in a sql table or as jobs on a file system and run a script from the console.

otherwise you block some web server instances.

something like rabbitmq

all the best

Can you use Jquery file uploading method? So while ajax uploads the file, you can show something else in background div.

You can do a header("Location: foo.php"); after the script that you want to run. If you script doesn't output any headers, this is fine and it will redirect when the script completes.

If the script is very time-consuming, you will need to do an asynchronous call, probably via ajax, to the PHP script as you submit the form, and then the form target can be where you'd like the redirection to be.

header('location:'sumthng.php');

在您的操作页面中给出

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