Zend Framework cookie management

后端 未结 2 535
梦毁少年i
梦毁少年i 2020-12-31 07:31

i want to know if Zend Framework has any class for handling cookies. a class that wraps php\'s setcookie() function for example. thanks in advance.

相关标签:
2条回答
  • 2020-12-31 07:53

    If you wan't for example $_COOKIE['foo'] you use

    $this->getRequest()->getCookie('foo');
    

    What I've talked in #zftalk @freenode PHP's own setcookie() is correct way to set client's cookie.

    0 讨论(0)
  • 2020-12-31 08:07

    Zend_Http_Cookie is just a component to create RFC compatible cookie strings and to test a cookie against a given HTTP request scenario. Its primary purpose is to assist in cookie-scenarios with Zend_Http_Client in the Zend_Http package.

    I assume that you're looking for a wrapper set cookies - perhaps compared to Zend_Session. There currently is no such component to assist you with creating cookies (setcookie() is the right way to go). To read cookies you can resort to the appropriate method Zend_Controller_Request_Http::getCookie($key = null, $default = null).

    0 讨论(0)
提交回复
热议问题