Home > Backend Development > PHP Tutorial > 输出缓存 JS失效 的问题

输出缓存 JS失效 的问题

WBOY
Release: 2016-06-23 14:09:21
Original
731 people have browsed it

页面使用了php 输出缓存 依次分批输出内容,后输出的内容中含JS,却不执行(我使用的是chrome浏览器),为什么?

<?phpecho '前面的内容......';@ob_flush();@flush();echo '后面的内容......<script> location.href="abc.html"; </script>'; //这里JS不执行呢@ob_flush();@flush();?>
Copy after login


回复讨论(解决方案)

这是你服务器的问题

运行可以跳转啊

<?phpecho '前面的内容......';@ob_flush();@flush();echo '后面的内容......'; //有可能这么的代码有问题,比如html的闭包问题.应该</div>的笔误变成了<div>?><script> location.href="abc.html"; </script> <!-- 放到PHP代码外,看看什么情况?--><?php@ob_flush();@flush();?>
Copy after login

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template