更新内核,API接口开发的一些尝试,后期会增加API接口开发这块

This commit is contained in:
2017-05-22 20:48:10 +08:00
parent a4d58f9f09
commit 426195eb90
47 changed files with 1339 additions and 513 deletions

View File

@@ -19,7 +19,6 @@ use think\response\Xml as XmlResponse;
class Response
{
// 原始数据
protected $data;
@@ -50,12 +49,12 @@ class Response
public function __construct($data = '', $code = 200, array $header = [], $options = [])
{
$this->data($data);
$this->header = $header;
$this->code = $code;
if (!empty($options)) {
$this->options = array_merge($this->options, $options);
}
$this->contentType($this->contentType, $this->charset);
$this->header = array_merge($this->header, $header);
$this->code = $code;
}
/**
@@ -113,7 +112,11 @@ class Response
http_response_code($this->code);
// 发送头部信息
foreach ($this->header as $name => $val) {
header($name . ':' . $val);
if (is_null($val)) {
header($name);
} else {
header($name . ':' . $val);
}
}
}