-- darren <[EMAIL PROTECTED]> wrote
(on Saturday, 05 April 2008, 10:13 AM -0500):
> Is there any reason why this would not be setting a cookie?  The code
> doesn't generate any errors.  It just doesn't set a cookie.  If I put
> in setcookie('name', 'value'), that will work.
> 
> $cookie = md5($username . $id . "_somerandomstring_");
> Zend_Loader::loadClass("Zend_Http_Client");
> require_once "Zend/Http/Cookie.php";
> $client = new Zend_Http_Client();
> $cookie = new Zend_Http_Cookie('foo', $cookie, '.mydomain.com', time()
> + 7200, '/path');
> $client->setCookieJar();
> $client->setCookie($cookie);

Zend_Http_Cookie is for use with Zend_Http_Client which is for making
requests to *other* services -- not for setting cookies for a client
browser. Use setcookie().

> The code above raises a side question.  I don't want to get
> sidetracked.  But, I guess I'll ask it now, what's the difference
> between require_once and Zend_Loader::loadClass?

Zend_Loader::loadClass() allows you to pass a class name, and optionally
a list of directories in which to look for the class file. Typically,
require_once will be slightly faster... as long as the file is in your
include_path.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to