How I use Zend_Http_Cookie to set and read cookies?
I trie to set cookie like this:
$cookie = new Zend_Http_Cookie('TestCookie','TestValue','localhost.com')
but no cookie is generated. Also how I read cookies with Zend?
Thanks
The Set-Cookie header is sent by the server in response to an HTTP request, which is used to create a cookie on the user's system. The Cookie header is included by the client application with an HTTP request sent to a server, if there is a cookie that has a matching domain and path.
Zend_Cache provides a generic way to cache any data. Caching in Zend Framework is operated by frontends while cache records are stored through backend adapters ( File , Sqlite , Memcache ...) through a flexible system of IDs and tags.
Zend Framework is a collection of professional PHP packages with more than 570 million installations. It can be used to develop web applications and services using PHP 5.6+, and provides 100% object-oriented code using a broad spectrum of language features.
As far as i know is there not "setCookie" Class in Zend Framework. Simply use "plain" php:
setcookie('cookieName', 'value', 'lifetime', 'path', 'domain');
To read an cookie, you can use Zend_Controller_Request_Http();
as Example:
$request = new Zend_Controller_Request_Http();
$myCookie = $request->getCookie('cookieName');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With