Home > php教程 > php手册 > 修复success、error方法的一个小bug

修复success、error方法的一个小bug

WBOY
Release: 2016-06-07 11:45:31
Original
1808 people have browsed it

"本来当使用$this->assign('closeWin',true);后,再调用success或error方法,提示显示完了之后窗口就会自动关闭.但某些浏览器却不能关闭窗口"的bug的修复方法
系统Action类中的success方法和error方法存在一个小bug,算是一个不足之处.

原先设计是:当使用$this->assign('closeWin',true);后,再调用success或error方法,提示显示完了之后窗口就会自动关闭.

实际效果:某些浏览器却不能关闭窗口(比如谷歌浏览器)

原因:javascript代码不完善

解决办法:
依次展开ThinkPHP目录下的Lib/Core,找到Action.class.php文件
找到dispatchJump函数(success和error实际调用此函数).
将if($this->get('closeWin')) $this->assign('jumpUrl','javascript:window.close();');
换成if($this->get('closeWin')) $this->assign('jumpUrl','javascript:window.opener=null;window.open(\'\',\'_self\',\'\');window.close();');

AD:真正免费,域名+虚机+企业邮箱=0元

Related labels:
e
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template