PHP之session_write_close
2013-04-23 22:34
387 查看
session_write_close — Write
session data and end session
void session_write_close ( void )
End the current session and store session data.
Session data is usually stored after your script terminated without the need to call session_write_close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at
any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
以上是手册上给出的解释
大致意思就是:
session的数据,一般在脚本结束的时候,才被写入到session文件(session数据是以文件形式存储的)中
因为是写文件,所以为了防止并发,session同一时间只用于一个脚本打开并操作文件,其余的脚本会被锁住,必须等待前一个脚本执行完毕。
session_write_close就是提前释放这个文件锁,无需等到脚本执行结束。
所以上面的 End the current session and store session data 这个描述应该不是很准确,可能会导致误解。
session data and end session
![](http://cn2.php.net/images/notes-reject.gif)
说明
void session_write_close ( void )End the current session and store session data.
Session data is usually stored after your script terminated without the need to call session_write_close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at
any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
以上是手册上给出的解释
大致意思就是:
session的数据,一般在脚本结束的时候,才被写入到session文件(session数据是以文件形式存储的)中
因为是写文件,所以为了防止并发,session同一时间只用于一个脚本打开并操作文件,其余的脚本会被锁住,必须等待前一个脚本执行完毕。
session_write_close就是提前释放这个文件锁,无需等到脚本执行结束。
所以上面的 End the current session and store session data 这个描述应该不是很准确,可能会导致误解。
相关文章推荐
- ajax异步请求php后台处理耗时任务session_write_close
- PHP Session锁及并发机制 | void session_write_close(void)函数
- on line 44 Warning: session_write_close() [function.session-write-close]:..\index.php on line 44
- session_write_close() PHP在访问Session数据时存在互斥情况,导致Ajax请求响应缓慢
- Warning: session_write_close() [function.session-write-close]:..\index.php on line 44
- php提示Failed to write session data错误的解决方法
- php session阻塞页面分析及优化 (session_write_close session_commit使用)
- php session阻塞页面分析及优化 (session_write_close session_commit使用)
- Session锁和session_write_close和session_commit函数
- php输出在session_write中写入的数据
- phpMyAdmin访问出错,session_write_close()出错
- WriteFileSession_usrname.php
- php session阻塞页面分析及优化 (session_write_close session_commit使用)
- phpMyAdmin升级出错,session_write_close()出错
- PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)
- php提示Failed to write session data错误的解决方法
- PHP+mysql系统报错:PHP message: PHP Warning: Unknown: Failed to write session data (files)
- joomla 安装不上,出现Warning: session_start():Warning: session_write_close()错误
- php session阻塞页面分析及优化 (session_write_close session_commit使用)
- PHP学习笔记 11 - Session