在PHP中window.setTimeout等效? [英] window.setTimeout equivalent in PHP?
问题描述
有没有一种简单的方法来实现PHP等价于
window.setTimeout?
在一个javascript网络应用程序中,它通常是事情是在事件驱动的基础上完成的。例如,html元素可能有东西
就像onclick =" buttonClicked()"表示单击该元素时应运行函数
buttonClicked。
模拟可以使用com_event_sink在PHP(在Windows上)完成。在
中,您可以通过PHP函数响应COM对象(例如,Excel,Internet Explorer,Word等)的事件。
当然,在你的PHP脚本结束时你将有一个循环到
的效果($ GLOBALS [''keepLooping'' ]){com_message_pump(200); }
以便PHP脚本保留在内存中并且不会终止。那就是
,这样就可以获得那些事件回调函数。
到目前为止,非常好。
然而,让PHP函数在定时的基础上运行(没有任何
延迟循环)似乎并不那么容易,这导致我的问题:是
有一个直截了当实现PHP等效的方式
window.setTimeout?
换句话说,我希望能够在启动PHP函数之后启动它a
已经过了一定的时间。一种可能的方式来考虑这个
是一个事件驱动的睡眠。这样做的一种方法是确保我有IE的b $ ba副本,然后我可以使用IE的窗口'自己的.setTimeout来
领带它变成了PHP,但这有点凌乱,更何况我没有像IE要求那样
。
感谢您的任何想法,
来自维也纳的Csaba Gabor
GLOBALS [''keepLooping'']){com_message_pump(200) ; }
以便PHP脚本保留在内存中并且不会终止。那就是
,这样就可以获得那些事件回调函数。
到目前为止,非常好。
然而,让PHP函数在定时的基础上运行(没有任何
延迟循环)似乎并不那么容易,这导致我的问题:是
有一个直截了当实现PHP等效的方式
window.setTimeout?
换句话说,我希望能够在启动PHP函数之后启动它a
已经过了一定的时间。一种可能的方式来考虑这个
是一个事件驱动的睡眠。这样做的一种方法是确保我有IE的b $ ba副本,然后我可以使用IE的窗口'自己的.setTimeout来
领带它变成了PHP,但这有点凌乱,更何况我没有像IE要求那样
。
感谢您的任何想法,<来自维也纳的Csaba Gabor
Csaba Gabor写道:
是否有一种简单的方法来实现PHP等价于
window.setTimeout?
在一个javascript网络应用程序中,通常情况就是如此以事件驱动为基础完成
。例如,html元素可能有东西
就像onclick =" buttonClicked()"表示单击该元素时应运行函数
buttonClicked。
模拟可以使用com_event_sink在PHP(在Windows上)完成。在
中,您可以通过PHP函数响应COM对象(例如,Excel,Internet Explorer,Word等)的事件。
当然,在你的PHP脚本结束时你将有一个循环到
的效果,而(
GLOBALS [''keepLooping'']){com_message_pump(200); }
以便PHP脚本保留在内存中并且不会终止。那就是
,这样就可以获得那些事件回调函数。
到目前为止,非常好。
然而,让PHP函数在定时的基础上运行(没有任何
延迟循环)似乎并不那么容易,这导致我的问题:是
有一个直截了当实现PHP等效的方式
window.setTimeout?
换句话说,我希望能够在启动PHP函数之后启动它a
已经过了一定的时间。一种可能的方式来考虑这个
是一个事件驱动的睡眠。这样做的一种方法是确保我有IE的b $ ba副本,然后我可以使用IE的窗口'自己的.setTimeout来
领带它变成了PHP,但这有点凌乱,更何况我没有像IE要求那样
。
感谢您的任何想法,
来自维也纳的Csaba Gabor
不,PHP不是一种事件驱动的语言。并且,作为一个网络应用程序,它收到
没有来自客户端的事件。
你究竟想做什么?
>
-
==================
删除x来自我的电子邮件地址
Jerry Stuckle
JDS计算机培训公司
js ******* @ attglobal.net
==================
Is there a straightforward way of implementing a PHP equivalent to
window.setTimeout?
In a javascript web app, it''s often the case that things are done on
an event driven basis. For example, html elements might have things
like onclick="buttonClicked()" to indicate that the function
buttonClicked should be run when that element is clicked.
The analogue can be done in PHP (on Windows) using com_event_sink. In
other words, you can respond to events that a COM object (such as
Excel, Internet Explorer, Words, etc) experiences via a PHP function.
Of course, at the end of your PHP script you would have a loop to the
effect of
while ($GLOBALS[''keepLooping'']) { com_message_pump(200); }
so that the PHP script stays in memory and doesn''t terminate. That is
to say, in this way those event callback functions will be available.
So far, so good.
However, getting a PHP function to run on a timed basis (without any
delay loops) does not seem so easy, which leads to my question: Is
there a straightforward way of implementing a PHP equivalent to
window.setTimeout?
In other words, I''d like to be able to kick off a PHP function after a
certain amount of time has elapsed. One possible way to think of this
is an event driven Sleep. One way to do this is to ensure that I have
a copy of IE up, and then I can use IE''s window''s own .setTimeout to
tie it into PHP, but this is a bit messy not to mention that I don''t
like the IE requirement.
Thanks for any ideas,
Csaba Gabor from Vienna
GLOBALS[''keepLooping'']) { com_message_pump(200); }
so that the PHP script stays in memory and doesn''t terminate. That is
to say, in this way those event callback functions will be available.
So far, so good.
However, getting a PHP function to run on a timed basis (without any
delay loops) does not seem so easy, which leads to my question: Is
there a straightforward way of implementing a PHP equivalent to
window.setTimeout?
In other words, I''d like to be able to kick off a PHP function after a
certain amount of time has elapsed. One possible way to think of this
is an event driven Sleep. One way to do this is to ensure that I have
a copy of IE up, and then I can use IE''s window''s own .setTimeout to
tie it into PHP, but this is a bit messy not to mention that I don''t
like the IE requirement.
Thanks for any ideas,
Csaba Gabor from Vienna
Csaba Gabor wrote:Is there a straightforward way of implementing a PHP equivalent to
window.setTimeout?
In a javascript web app, it''s often the case that things are done on
an event driven basis. For example, html elements might have things
like onclick="buttonClicked()" to indicate that the function
buttonClicked should be run when that element is clicked.
The analogue can be done in PHP (on Windows) using com_event_sink. In
other words, you can respond to events that a COM object (such as
Excel, Internet Explorer, Words, etc) experiences via a PHP function.
Of course, at the end of your PHP script you would have a loop to the
effect of
while (
GLOBALS[''keepLooping'']) { com_message_pump(200); }
so that the PHP script stays in memory and doesn''t terminate. That is
to say, in this way those event callback functions will be available.
So far, so good.
However, getting a PHP function to run on a timed basis (without any
delay loops) does not seem so easy, which leads to my question: Is
there a straightforward way of implementing a PHP equivalent to
window.setTimeout?
In other words, I''d like to be able to kick off a PHP function after a
certain amount of time has elapsed. One possible way to think of this
is an event driven Sleep. One way to do this is to ensure that I have
a copy of IE up, and then I can use IE''s window''s own .setTimeout to
tie it into PHP, but this is a bit messy not to mention that I don''t
like the IE requirement.
Thanks for any ideas,
Csaba Gabor from Vienna
No, PHP is not an event-driven language. And, as a web app, it receives
no events from the client.
What exactly are you trying to do?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
这篇关于在PHP中window.setTimeout等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!