简体   繁体   English

多个Php页面不能在一个浏览器中同时加载

[英]Multiple Php pages Do Not load at the same time in one Browser

For some reason, I found there is a problem when viewing my website, that only one php page can be loaded at a time in the browser. 出于某种原因,我发现查看我的网站时出现问题,浏览器中一次只能加载一个php页面。 For example, if I open "PageA.php" then open "PageB.php", "PageB.php" does not return any result (shows loading..) until "PageA.php" finishes loading. 例如,如果我打开“PageA.php”然后打开“PageB.php”,“PageB.php”不会返回任何结果(显示loading ..),直到“PageA.php”完成加载。

I am using Apache Httpd on CentOS. 我在CentOS上使用Apache Httpd。 Can someone help me please? 有人能帮助我吗?

Thanks!! 谢谢!!

You're probably using file-based PHP sessions, which by default lock the session file when a particular script instance is using the session. 您可能正在使用基于文件的PHP会话,默认情况下会在特定脚本实例使用会话时锁定会话文件。 This will cause any other hits on scripts that use the same session to be locked out until the first script is completed. 这将导致在第一个脚本完成之前锁定使用相同会话的脚本上的任何其他命中。

If you need to have long-running scripts and/or allow parallel usage of the pages, you'll have to explicitly release the session lock in the scripts with session_write_close() . 如果您需要长时间运行的脚本和/或允许并行使用页面,则必须使用session_write_close()在脚本中显式释放会话锁定。

If you do so, $_SESSION will still be available for read/writing, but will no longer auto-save changes when the scripts exits. 如果这样做, $_SESSION仍然可用于读/写,但在脚本退出时将不再自动保存更改。 You can, however, do another session_start() later (assuming no output has been performed) to "resume" the session and enable the auto-save behavior again. 但是,您可以稍后执行另一个session_start() (假设未执行任何输出)以“恢复”会话并再次启用自动保存行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM