开发者

is it different 'default ' and 'Default' in zend default session namespace?

I am using sessions in zend framework.

the question is i need to know is there a difference between

new Zend_Session_Namespace("default");

and

new Zend_Session_Namespace("Default");

in my application, I have used both, it seems the code is not working correctly, if there is a difference, what is the correct one to use.

here is my code

<?php
class Admin_DashboardController extends Zend_Controller_Action
{
    function init()
    {
        //
    }


    /**
     * Add hotelId to default session
     * redirect to admin/hot开发者_JAVA技巧els if hotelId is not avialble  
     */ 
    public function indexAction()
    {       
        $params = $this->getRequest()->getParams();
        $hotelid = NULL;

            $config_session = new Zend_Session_Namespace("default");
            $config_session->hotelid = $params['id'];

        if(isset($params['id']) && !empty($params['id'])){

        }else{

            //redirect user to select hotels page
            $redirector = new Zend_Controller_Action_Helper_Redirector();

            $url = array(
                'action' => 'admin/hotels/index'
            );

            $redirector->gotoRouteAndExit($url);

        }                   
    }
}


All Zend_Session_Namespace does internally is create a named array inside the $_SESSION superglobal. As array keys in PHP are case sensitive, "Default" and "default" will be treated as separate namespaces.

You can use whichever one you want, just be consistent if you expect to use the same data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜