data() public method

输出数据设置
public data ( mixed $data )
$data mixed 输出数据
Example #1
0
 /**
  * @covers think\Response::data
  * @todo Implement testData().
  */
 public function testData()
 {
     $data = "data";
     Response::data($data);
     Response::data(null);
 }
Example #2
0
 /**
  * 输出返回数据
  * @access protected
  * @param mixed $data 要返回的数据
  * @param String $type 返回类型 JSON XML
  * @param integer $code HTTP状态
  * @return void
  */
 protected function response($data, $type = '', $code = 200)
 {
     Response::sendHttpStatus($code);
     Response::data($data);
     if ($type) {
         Response::type($type);
     }
 }
Example #3
0
 /**
  * 输出返回数据
  * @access protected
  * @param mixed $data 要返回的数据
  * @param String $type 返回类型 JSON XML
  * @param integer $code HTTP状态
  * @return void
  */
 protected function response($data, $type = '', $code = 200)
 {
     http_response_code($code);
     Response::data($data);
     if ($type) {
         Response::type($type);
     }
 }