如何在PHP中关闭浏览器窗口? [英] How to close browser window in PHP?

查看:93
本文介绍了如何在PHP中关闭浏览器窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用PHP代码关闭当前(活动)窗口?

Is there a way to close the present (active) window using PHP code?

推荐答案

RonS< ro ****** ****@SPAMtds.net>在新闻中写道:40 ******** @ newspeer2.tds.net:
RonS <ro**********@SPAMtds.net> wrote in news:40********@newspeer2.tds.net:
有没有办法用PHP代码关闭当前(活动)窗口?
Is there a way to close the present (active) window using PHP code?




你可以在php

代码完成后插入一个javascript语句来关闭窗口。但是这只有在代码应该用于b / b
做一些用户从未看到结果的东西时才会有用......或者传递给

我认为是另一个窗口。比如打开子窗口,执行一些

代码,将结果传递给父级,然后关闭窗口。



you can insert a javascript statement to close the window after the php
code is finished. But this would only be useful if the code is supposed to
do something that the user never sees the results from... or are passed to
another window I suppose. Such as opening a child window, performing some
code, passing the results to the parent, then closing the window.


在文章< 40S****@newspeer2.tds.net>,RonS写道:
In article <40********@newspeer2.tds.net>, RonS wrote:
有没有办法用PHP代码关闭当前(活动)窗口?
Is there a way to close the present (active) window using PHP code?




PHP在服务器端执行,因此不了解客户端,

浏览器或这些浏览器的窗口。


使用JavaScript,您可以访问windows上的window.close

您使用window.open函数打开。


您为什么要这样做?无论如何关闭别人的窗户?大多数人都不会像愚蠢的网页设计师那样试图弄乱他们的窗户。


-

Tim Van Wassenhove < http://home.mysth.be/~timvw/contact.php>



PHP is executed at the server-side and thus does not know about clients,
browsers or windows of those browsers.

With JavaScript you might have access to call window.close on windows
you opened with the window.open function.

Why would you want to close someone''s window anyway? Most people don''t
like silly webdesigners trying to mess with their windows anyway.

--
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>




" Theo" <在***** @ noemail.com>在消息中写道

news:Xn ************************ @ 216.168.3.44 ...

"Theo" <in*****@noemail.com> wrote in message
news:Xn************************@216.168.3.44...
RonS< ro ********** @ SPAMtds.net>写在
news:40 ******** @ newspeer2.tds.net:
RonS <ro**********@SPAMtds.net> wrote in news:40********@newspeer2.tds.net:
有没有办法用PHP代码关闭当前(活动)窗口?
Is there a way to close the present (active) window using PHP code?



你可以在php
代码完成后插入一个javascript语句来关闭窗口。但是,如果代码应该执行用户从未看到结果的某些内容......或者传递给我认为的另一个窗口,那么这只会很有用。比如打开子窗口,执行一些代码,将结果传递给父级,然后关闭窗口。



you can insert a javascript statement to close the window after the php
code is finished. But this would only be useful if the code is supposed to
do something that the user never sees the results from... or are passed to
another window I suppose. Such as opening a child window, performing some
code, passing the results to the parent, then closing the window.




<?php

echo''< BUTTON onclick =" window.close();">关闭我。< / BUTTON>'';

?>


嘿,这是PHP。 ;-)


Garp



<?php
echo ''<BUTTON onclick="window.close();">Close me.</BUTTON>'';
?>

Hey, it''s PHP. ;-)

Garp


这篇关于如何在PHP中关闭浏览器窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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