异步函数调用? [英] Asynchronous function call?

查看:107
本文介绍了异步函数调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


有一种异步执行函数的方法吗?

我需要执行一个太慢的函数但对我来说可以是在

背景中执行......没有办法???


谢谢

Hi all

There is a way to exec a function asynchronously?
I need to exec a function that is too slow but for me can be executed in the
background... there is no way???

Thanks

推荐答案

8月11日下午12:47,Fabio < znt.fa ... @ virgilio.itwrote:
On Aug 11, 12:47 pm, "Fabio" <znt.fa...@virgilio.itwrote:

大家好


有办法执行异步函数?

我需要执行一个太慢的函数但是对于我来说可以在

背景中执行...没有办法???


谢谢
Hi all

There is a way to exec a function asynchronously?
I need to exec a function that is too slow but for me can be executed in the
background... there is no way???

Thanks



我认为exec()上的手册非常清楚:


< http://www.php.net/exec>


"注意:如果您使用此功能启动程序并想要保留它

在后台运行,你必须确保该程序被重定向到文件或其他输出流的输出

或者

否则PHP会挂起直到程序的执行结束。

I think the manual on exec() makes it pretty clear:

<http://www.php.net/exec>

"Note: If you start a program using this function and want to leave it
running in the background, you have to make sure that the output of
that program is redirected to a file or some other output stream or
else PHP will hang until the execution of the program ends."


8月11日,上午11:47,Fabio < znt.fa ... @ virgilio.itwrote:
On Aug 11, 11:47 am, "Fabio" <znt.fa...@virgilio.itwrote:

大家好


有办法执行异步函数?

我需要执行一个太慢的函数但是对于我来说可以在

背景中执行...没有办法???


谢谢
Hi all

There is a way to exec a function asynchronously?
I need to exec a function that is too slow but for me can be executed in the
background... there is no way???

Thanks



是和否。


PHP,是一种极端的语言,可以用很多想象力做很多

的事情=)。首先,我们真的需要知道你在做什么,为什么以及为什么做b $ b。通过你使用术语''异步'',我/ b $ b假设你可能有很多关于编程和线程的数据。所以,

我不是想要攻击你的判断,而是想以最好的方式帮助你。


在这样做的方法是从您的基本PHP

脚本中调用/多个CLI脚本,让它们在后台处理,如果你需要做更多的事情

希望您的基数与脚本,并回到他们,稍后阅读

结果(如果你愿意)。

Yes and no.

PHP, being an extreamly veristile language, can be made to do many
thing with enough imagination =). First, we really need to know what
you are doing, how, and why. By you using the term ''asynchronous'', I
assume you probably a good amount about programming and threads. So,
I''m not trying to assault you''re judgement, but wanting to help you in
the best way.

On way to do this is to call a/multiple CLI scripts from your base PHP
script, let them process in the background, do some more things if you
would like with your "base" script, and get back to them, reading the
results later on (if you want).


" ELINTPimp" < sm ***** @ gmail.comha scritto nel messaggio

news:11 ********************** @ k79g2000hse .googlegr oups.com ...
"ELINTPimp" <sm*****@gmail.comha scritto nel messaggio
news:11**********************@k79g2000hse.googlegr oups.com...

PHP,是一种极端的语言,可以做很多想象力的事情。 =)。首先,我们真的需要知道你在做什么,为什么以及为什么做b $ b。通过你使用术语''异步'',我/ b $ b假设你可能有很多关于编程和线程的数据。所以,

我不是想要攻击你的判断,而是想以最好的方式帮助你。


在这样做的方法是从您的基本PHP

脚本中调用/多个CLI脚本,让它们在后台处理,如果你需要做更多的事情

希望您的基数与脚本,并回到他们,稍后阅读

结果(如果你想)。
PHP, being an extreamly veristile language, can be made to do many
thing with enough imagination =). First, we really need to know what
you are doing, how, and why. By you using the term ''asynchronous'', I
assume you probably a good amount about programming and threads. So,
I''m not trying to assault you''re judgement, but wanting to help you in
the best way.

On way to do this is to call a/multiple CLI scripts from your base PHP
script, let them process in the background, do some more things if you
would like with your "base" script, and get back to them, reading the
results later on (if you want).



好​​的,谢谢你我'll解释。

在网站页面中,当有人按下提交按钮时,我应该执行

mail()函数向每个注册用户发送电子邮件。

mail()的执行有点慢,所以如果用户列表有点

多长按下按钮需要等待获取与<的交互br $>
网站。

我的想法是在后台执行所有对mail()的调用,所以交互

是即时的,如果发送邮件使用一些隐藏的分钟,这不是一个

的问题。


我希望我的英语和新手php语言很清楚:)

再次感谢。

Ok, I thank you and I''ll explain.
In a web site page, when someone press a submit button I should exec a
mail() function to send an email to each registered user.
The execution of mail() is a little slow, so if the user list is a little
long who pressed the button need to wait to obtain the interaction with the
site.
My idea is to exec all the calls to mail() in background, so the interation
is immediate and if the mail sending use some "hidden" minutes it''s not a
problem.

I hope I was clear wth my english and newbie php language :)

Thanks again.


这篇关于异步函数调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆