标签归档:session

php session session_set_save_handler 机制

php自身带功能,将session的数据从之前的files 改变到其他任何地方。比如mysql redis等等,方便你分布式的集群应用。 看一下原理 <?php /** *Session open (called by session_start( )) *Session close (called at page end) *Session read (called after session_start( ) ) *Session write (called when session data is to be written) *Session destroy (called by session_destroy( … 继续阅读

发表在 PHP | 标签为 , , | 留下评论

解决session定时失效问题

<img id="phpImg" src="admin_session.php?" width="1" height="1" />   <script type="text/javascript"> function keepMeAlive(imgName){ myImg = document.getElementById(imgName); if(myImg) myImg.src = myImg.src.replace(/\?.*$/, ‘?’ + Math.random()); } window.setInterval("keepMeAlive(‘phpImg’);", 10000); </script> 10秒刷新一次session //window.setInterval(“keepMeAlive(‘phpImg’);”, 10000);

发表在 PHP | 标签为 | 一条评论