简体   繁体   中英

shell_exec php example

Hi there are multiple specific examples but I just wanted to have a working generic calling PHP into background example from shell_exec.

So my php function runs a large processing job.

On the top of the script (process.php) I put?

!#usr/bin/php

i think - any way to get that specific path, maybe 'which php'?

then the actual command is

shell_exec(sprintf('php process.php %s %s > /dev/null 2>/dev/null &','data1','data2'));

and access the data from process.php with argsv[1] and argsv[2]

?

thanks

您需要使用参数在PHP脚本上运行curl multi exec ,并在运行后收到答案,例如: http://localhost/phpjob.php?par1=asdasd&par2=1212....

You can definitely access the arguments from process.php the way you described, but why would you want to kick off process.php like that?

If you're already in a php shell script, why not just include the process.php file?

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