当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::__construct方法代码示例

本文整理汇总了PHP中Phalcon\Http\Response::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::__construct方法的具体用法?PHP Response::__construct怎么用?PHP Response::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phalcon\Http\Response的用法示例。


在下文中一共展示了Response::__construct方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     parent::setHeader('Access-Control-Allow-Origin', '*');
     parent::setHeader('Access-Control-Allow-Headers', 'X-Requested-With');
     $this->setStatusCode(self::DEFAULT_STATUS_CODE);
 }
开发者ID:Archcry,项目名称:PhalconApiBase,代码行数:7,代码来源:Response.php

示例2: __construct

 public function __construct(Response $response)
 {
     parent::__construct();
     $this->setStatusCode($response->getStatusCode(), $response->getStatusMessage());
     $this->data = $response->getData();
     $this->meta = $response->getMeta();
     $this->messages = $response->getMessages();
 }
开发者ID:spuy767,项目名称:api,代码行数:8,代码来源:JSONResponse.php

示例3: __construct

 /**
  * @param ResponsePayload $body
  * @param int|null $code
  * @param string|null $status
  */
 public function __construct(ResponsePayload $body, $code = null, $status = null)
 {
     parent::__construct(null, $code, $status);
     $this->setContentType('application/json');
     $this->setHeader('Access-Control-Allow-Origin', '*');
     $this->setHeader('Access-Control-Allow-Methods', 'GET,HEAD,PUT,PATCH,POST,DELETE');
     $this->setHeader('Access-Control-Allow-Headers', 'Content-Type, X-Requested-With, Authorization');
     $this->setJsonContent($body);
 }
开发者ID:alevikzs,项目名称:phrest,代码行数:14,代码来源:Response.php

示例4: __construct

 /**
  * @param Response $controllerResponse
  */
 public function __construct($controllerResponse)
 {
     if ($controllerResponse instanceof ResponseArray) {
         foreach ($controllerResponse->getResponses() as $response) {
             $this->records[] = $response->getData();
         }
     } elseif ($controllerResponse instanceof Response) {
         $this->records[] = $controllerResponse->getData();
     }
     parent::__construct();
 }
开发者ID:phrest,项目名称:api,代码行数:14,代码来源:CSVResponse.php

示例5: __construct

 /**
  * PHPWebDevelopers\Api\Common\Http\Response constructor
  *
  * @param string $content
  * @param int $code
  * @param string $status
  */
 public function __construct($content = null, $code = null, $status = null)
 {
     parent::__construct($content, $code, $status);
     $request = new PhalconRequest();
     //@TODO Security fail!! Please do not go with this BETA
     $origin = $request->getHeader("ORIGIN");
     if (!empty($origin)) {
         parent::setHeader("Access-Control-Allow-Origin", $origin);
     }
     parent::setContentType(self::CONTENT_TYPE_JSON, self::CHARSET);
     parent::setHeader("Access-Control-Allow-Methods", self::ALLOW_METHODS);
     parent::setHeader("Access-Control-Allow-Headers", self::ALLOW_HEADERS);
     parent::setHeader("Access-Control-Allow-Credentials", self::ALLOW_CREDENTIALS);
 }
开发者ID:phpwebdevelopers,项目名称:api-common,代码行数:21,代码来源:Response.php

示例6: __construct

 public function __construct($content = null)
 {
     parent::__construct();
     $this->setContentType('application/json', 'UTF-8');
     $this->setContent($content);
 }
开发者ID:tmquang6805,项目名称:phalex,代码行数:6,代码来源:ResponseJson.php

示例7: __construct

 public function __construct($content = null, $code = null, $status = null)
 {
     parent::__construct();
     $this->setJsonContent($content);
 }
开发者ID:sb15,项目名称:phalcon-ext,代码行数:5,代码来源:Json.php

示例8: __construct

 public function __construct($content = null, $code = null, $status = null)
 {
     parent::__construct($content, $code, $status);
     $this->setHeader('Content-Type', 'application/json');
 }
开发者ID:VladimirLichonos,项目名称:phalcon,代码行数:5,代码来源:ApiResponse.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     $this->errorMessages = ErrorMessages::$messages;
 }
开发者ID:k0l1br1,项目名称:phalcon-modular-rest-skeleton,代码行数:5,代码来源:Response.php

示例10: __construct

 public function __construct($content = null, $code = null, $status = null)
 {
     parent::__construct($content, $code, $status);
     $this->setContentType("application/json", "UTF-8");
 }
开发者ID:nvg58,项目名称:uethackathon2015_team08server,代码行数:5,代码来源:ApiResponse.php

示例11: __construct

 /**
  * @param Template|string|null $content
  * @param int|null $code
  * @param array $headers
  */
 public function __construct($content = null, $code = null, $headers = [])
 {
     parent::__construct();
     if ($content) {
         $this->setContent($content);
     }
     if ($code) {
         $this->setStatusCode($code);
     }
     foreach (array_merge(static::$defaultHeaders, $headers) as $name => $value) {
         $this->setHeader($name, $value);
     }
 }
开发者ID:dubhunter,项目名称:talon,代码行数:18,代码来源:Response.php


注:本文中的Phalcon\Http\Response::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。