断开客户端浏览器与php文件的连接 [英] Disconnecting client browser from php file

查看:106
本文介绍了断开客户端浏览器与php文件的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用标准的httpd请求启动一个php脚本,但

然后允许客户端浏览器断开连接而不终止

脚本。释放浏览器以访问网站上的其他功能。


虽然connection_timeout()和ignore_user_abort()

的组合可以阻止脚本终止时客户拨打

终止,我想终止客户端连接,而不是等待客户端这么做。




< ;?

echo清理已启动;

return_control_to_client_browser_as_if_script_term inated();

run_verylong_dull_cleanup_utility_client_need_not_ know_about():

?>

I''d like to initiate a php script using a standard httpd request, but
then allow the client browser to disconnect without terminating the
script. Freeing up the browser to access other functions on the site.

Whilst a combination of connection_timeout() and ignore_user_abort()
can stop the script from terminating when the client calls
termination, i''d like to terminate the clients connection rather than
having to wait for the client to do it.

i.e.

<?
echo "Cleanup initiated";
return_control_to_client_browser_as_if_script_term inated();
run_verylong_dull_cleanup_utility_client_need_not_ know_about():
?>

推荐答案



" chris" < CH *** @ remotegoat.co.uk>在消息中写道

新闻:10 ************************** @ posting.google.c om ...

"chris" <ch***@remotegoat.co.uk> wrote in message
news:10**************************@posting.google.c om...
我想使用标准的httpd请求启动一个php脚本,但
然后允许客户端浏览器断开连接而不终止
脚本。释放浏览器以访问站点上的其他功能。


我认为你对PHP工作的服务器端脚本语言如何工作的理解存在严重缺陷。当PHP脚本生成一个网页

(这是一个HTML文档)时它会立即终止,所以当

客户端浏览器收到该页面并开始呈现它时PHP脚本已经死了
已经死了。如果用户点击页面中的超链接,则这是作为全新请求传输的

,而不是当前

请求的延续。它可能与之前的脚本相同,也可能是一个不同的

脚本,但它是一个新请求。


没有持久连接在Web浏览器和Web服务器之间 -

HTTP协议完全是无状态的。我不知道你是什么意思

试图这样做,你的描述留给相信你不知道


< br $> b $ b -

Tony Marston
http ://www.tonymarston.net


虽然connection_timeout()和ignore_user_abort()
的组合可以阻止脚本在客户端调用时终止<终止,我想终止客户端连接,而不是等待客户端这样做。



< ?
echo" Cleanup started" ;;
return_control_to_client_browser_as_if_script_term inated();
run_verylong_dull_cleanup_utility_client_need_not_know_about():
?>
I''d like to initiate a php script using a standard httpd request, but
then allow the client browser to disconnect without terminating the
script. Freeing up the browser to access other functions on the site.
I think that your understanding of how server-side scripting languages such
as PHP work is seriously flawed. When a PHP script generates a web page
(which is an HTML document) it immediately terminates, so by the time the
client browser receives the page and starts to render it the PHP script has
already died. If the user clicks on a hyperlink within the page then this is
transmitted as a brand new request, not as a continuation of the current
request. It may be to the same script as before, or it may be a different
script, but it is a new request.

There are no persistent connections between a web browser and a web server -
the HTTP protocol is totally stateless. I do not know what it is you are
trying to do, and your description leaves to to believe that you don''t know
either.

--
Tony Marston
http://www.tonymarston.net

Whilst a combination of connection_timeout() and ignore_user_abort()
can stop the script from terminating when the client calls
termination, i''d like to terminate the clients connection rather than
having to wait for the client to do it.

i.e.

<?
echo "Cleanup initiated";
return_control_to_client_browser_as_if_script_term inated();
run_verylong_dull_cleanup_utility_client_need_not_ know_about():
?>


< br>

2004年5月7日05:01:33 -0700, ch *** @ remotegoat.co.uk (chris)写道:
On 7 May 2004 05:01:33 -0700, ch***@remotegoat.co.uk (chris) wrote:
我想使用标准的httpd请求启动一个php脚本,但
然后允许客户端浏览器断开连接而不终止
脚本。释放浏览器以访问站点上的其他功能。


浏览器通常会同时处理多个http请求;例如,如果

他们正在下载带图像的页面。

虽然connection_timeout()和ignore_user_abort()
的组合可以阻止脚本当客户端调用终止时终止,我想终止客户端连接,而不是等待客户端这样做。
<?
echo" Cleanup started" ;;
return_control_to_client_browser_as_if_script_term inated();
run_verylong_dull_cleanup_utility_client_need_not_ know_about():
?>
I''d like to initiate a php script using a standard httpd request, but
then allow the client browser to disconnect without terminating the
script. Freeing up the browser to access other functions on the site.
Browsers will often handle multiple http requests simultaneously; if
they''re downloading a page with images, for example.
Whilst a combination of connection_timeout() and ignore_user_abort()
can stop the script from terminating when the client calls
termination, i''d like to terminate the clients connection rather than
having to wait for the client to do it. <?
echo "Cleanup initiated";
return_control_to_client_browser_as_if_script_term inated();
run_verylong_dull_cleanup_utility_client_need_not_ know_about():
?>



您可能最好安排使用cron而非
的清理工具,而不是依靠客户的要求来执行此操作。


-

David(@ priz.co.uk)



You may be better off scheduling your cleanup utility with cron rather
than relying upon a client request to do it.

--
David ( @priz.co.uk )


我注意到Message-ID:< c7 ***** **************@news.demon.co.uk>来自

Tony Marston包含以下内容:
I noticed that Message-ID: <c7*******************@news.demon.co.uk> from
Tony Marston contained the following:
我认为您对PHP服务器端脚本语言如何工作的理解存在严重缺陷。当PHP脚本生成一个网页
(它是一个HTML文档)时它立即终止,所以当
客户端浏览器收到该页面并开始呈现它时,PHP脚本已经
已经死了。
I think that your understanding of how server-side scripting languages such
as PHP work is seriously flawed. When a PHP script generates a web page
(which is an HTML document) it immediately terminates, so by the time the
client browser receives the page and starts to render it the PHP script has
already died.



我曾经认为,但我对odbc功能的体验建议

否则。


如果我写了


<?php

while(


I used to think that but my experiences with odbc functions suggests
otherwise.

If I write

<?php
while(


这篇关于断开客户端浏览器与php文件的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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