/** * @return bool */ protected function _write() { return Cookie::set($this->_name, $this->__toString(), $this->_lifetime); }
/** * 发送header信息 * * @param array $headers * @param bool $replace * @return $this */ protected function _sendHeadersToPhp(array $headers, $replace) { if (Base::getHttp()->headersSent()) { return $this; } foreach ($headers as $key => $line) { Base::getLog()->debug(__METHOD__ . ' send headers to php', ['key' => $key, 'value' => $line]); if ($key == 'Set-Cookie' && is_array($line)) { Base::getLog()->debug(__METHOD__ . ' set cookie headers', $line); foreach ($line as $name => $value) { Cookie::set($name, $value['value'], $value['expiration']); } continue; } Base::getHttp()->header($line, $replace); } return $this; }