Example #1
0
 public static function set()
 {
     $path = func_get_args();
     $val = array_pop($path);
     return \Lysine\array_set(self::$config, $path, $val);
 }
Example #2
0
 public function sendHeader()
 {
     // session必须要先于header处理
     // 否则会覆盖header内对于Cache-Control的处理
     if ($this->session) {
         if (!isset($_SESSION)) {
             session_start();
         }
         foreach ($this->session as $sess) {
             list($path, $val) = $sess;
             \Lysine\array_set($_SESSION, $path, $val);
         }
         $this->session = array();
     }
     // http 状态
     if ($status = self::httpStatus($this->code)) {
         header($status);
     }
     // 自定义http header
     foreach ($this->header as $name => $value) {
         $header = $value === null ? $name : $name . ': ' . $value;
         header($header);
     }
     $this->header = array();
     // cookie
     foreach ($this->cookie as $name => $config) {
         list($value, $expire, $path, $domain, $secure, $httponly) = $config;
         setCookie($name, $value, $expire, $path, $domain, $secure, $httponly);
     }
     $this->cookie = array();
     return $this;
 }