如何在Laravel中进行session_write_close()? [英] How to session_write_close() in Laravel?
问题描述
在Laravel中,在sleep()
之前运行session_write_close()
似乎没有任何作用,因为在当前连接完成之前,会话仍被其他请求阻止.
Running session_write_close()
before sleep()
in Laravel doesn't seem to be functioning as the session is still blocked from other requests until the current connection is complete.
我正在尝试在Laravel中sleep()
而不阻止其他请求.发现session_write_close()应该可以解决此处提到的问题: Laravel中的长时间轮询(sleep()函数使应用程序冻结).但这是行不通的. sleep()
仍在阻止其他请求.
I'm trying to sleep()
in Laravel without blocking other requests. Found out that session_write_close() should resolve the problem as mentioned here: Long polling in Laravel (sleep() function make application freeze). But it doesn't work. sleep()
is still blocking other requests.
项目应用程序是使用常规轮询和长轮询的聊天应用程序: http://github.com/doncadavona/laravel-angularjs-chat
The project app is a chat app using regular polling and long-polling: http://github.com/doncadavona/laravel-angularjs-chat
推荐答案
Laravel不使用PHP的会话处理功能.您必须使用
Laravel doesn't use PHP's session handling functions. You must use
$request->session()->save();
调用处理程序的write方法.但是,由于Laravel也未实现任何会话锁定机制,因此您不太可能看到与会话相关的任何阻塞,也不会看到ajax行为的任何变化,因为您已保存/关闭了会话.
to call a handler's write method. But, since Laravel also doesn't implement any session locking mechanism, you are unlikely to see any session related blocking, nor should you see any change in ajax behavior because you saved/closed the session.
这篇关于如何在Laravel中进行session_write_close()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!