目录结构调整

This commit is contained in:
2016-06-30 16:53:58 +08:00
parent 7eaa319115
commit 52f669abec
107 changed files with 4600 additions and 476 deletions

View File

@@ -93,9 +93,6 @@ class Response
// 处理输出数据
$data = $this->getContent();
// 监听response_data
Hook::listen('response_data', $data, $this);
if (!headers_sent() && !empty($this->header)) {
// 发送状态码
http_response_code($this->code);
@@ -165,6 +162,26 @@ class Response
return $this;
}
/**
* 设置页面输出内容
* @param $content
* @return $this
*/
public function content($content)
{
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
$content,
'__toString',
])
) {
throw new \InvalidArgumentException(sprintf('variable type error %s', gettype($content)));
}
$this->content = (string)$content;
return $this;
}
/**
* 发送HTTP状态
* @param integer $code 状态码
@@ -231,7 +248,7 @@ class Response
$this->header['Content-Type'] = $contentType . '; charset=' . $charset;
return $this;
}
/**
* 获取头部信息
* @param string $name 头部名称
@@ -257,17 +274,20 @@ class Response
*/
public function getContent()
{
$content = $this->output($this->data);
if ($this->content == null) {
$content = $this->output($this->data);
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
$content,
'__toString',
])
) {
throw new \InvalidArgumentException(sprintf('variable type error %s', gettype($content)));
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable([
$content,
'__toString',
])
) {
throw new \InvalidArgumentException(sprintf('variable type error %s', gettype($content)));
}
$this->content = (string)$content;
}
return (string) $content;
return $this->content;
}
/**