• Zend Session使用要点

    Posted on 十月 16th, 2008 inetdemon No comments

    在Zend_Session使用中需要注意以下几点

    1. 关闭PHP的 session.auto_start setting. 在php.ini, 或者 .htaccess中写:
    php_value session.auto_start 0

    2.不要直接使用session_start() 和Zend_Session_Namespace有冲突。

    3.简单方法:可以直接new一个Zend_Session_Namespace,但是这种方法需要注意不要在此代码之前输出header.

    4.麻烦但是不容易出问题的方法:使用Zend_Session::setOptions() 设置为strict, 防止自动自动zend session;在bootstrap中根据具体的action的需要,启动Zend_Session::start(),然后在action中new Zend_Session_Namespace。

    Leave a reply