public function cookie($name, $value=null) 
    {
        $str = '';
        if (is_array($name)) {
            $arr = [];
            foreach ($name as $k=>$v) {
                $arr[] = $k . '=' . $v;
            }
            $str = implode(';', $arr);
        } elseif ($value) {
            $str = $name . '=' . $value;
        } else {
            $str = $name;
        }
        
        $this->def['cookie'] = $this->def['cookie'] ? $this->def['cookie'].';'.$str : $str;

        return $this;
    }
public function cookie($name, $value=null) 
    {
        $str = '';
        if (is_array($name)) {
            $arr = [];
            foreach ($name as $k=>$v) {
                $arr[] = $k . '=' . $v;
            }
            $str = implode(';', $arr);
        } elseif ($value) {
            $str = $name . '=' . $value;
        } else {
            $str = $name;
        }
        
        $this->def['cookie'] = $this->def['cookie'] ? $this->def['cookie'].';'.$str : $str;

        return $this;
    }
public function cookie ( $ name , $ value = null ) { $ str = '' ; if ( is_array ( $ name ) ) { $ arr = [ ] ; foreach ( $ name as $ k => $ v ) { $ arr [ ] = $ k . '=' . $ v ; } $ str = implode ( ';' , $ arr ) ; } elseif ( $ value ) { $ str = $ name . '=' . $ value ; } else { $ str = $ name ; } $ this -> def [ 'cookie' ] = $ this -> def [ 'cookie' ] ? $ this -> def [ 'cookie' ] . ';' . $ str : $ str ; return $ this ; }
set request cookie
@param  string $name
@param  string $value
@return static
set request cookie