yii\web\Response::init PHP Method

init() public method

Initializes this component.
public init ( )
    public function init()
    {
        if ($this->version === null) {
            if (isset($_SERVER['SERVER_PROTOCOL']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.0') {
                $this->version = '1.0';
            } else {
                $this->version = '1.1';
            }
        }
        if ($this->charset === null) {
            $this->charset = Yii::$app->charset;
        }
        $this->formatters = array_merge($this->defaultFormatters(), $this->formatters);
    }

Usage Example

Example #1
0
 /**
  * Initialize the response.
  */
 public function init()
 {
     parent::init();
     $this->formatters = [self::FORMAT_THRIFT => 'UrbanIndo\\Yii2\\Thrift\\ResponseFormatter'];
     $this->_transport = new TBufferedTransport(new TPhpStream(TPhpStream::MODE_R | TPhpStream::MODE_W));
     $this->_protocol = new TBinaryProtocol($this->_transport, true, true);
 }
All Usage Examples Of yii\web\Response::init