mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进
This commit is contained in:
@@ -688,7 +688,7 @@ class Request
|
||||
{
|
||||
if (empty($this->post)) {
|
||||
$content = $this->input;
|
||||
if (empty($_POST) && 'json' == $this->type()) {
|
||||
if (empty($_POST) && 'application/json' == $this->contentType()) {
|
||||
$this->post = (array) json_decode($content, true);
|
||||
} else {
|
||||
$this->post = $_POST;
|
||||
@@ -713,7 +713,7 @@ class Request
|
||||
{
|
||||
if (is_null($this->put)) {
|
||||
$content = $this->input;
|
||||
if ('json' == $this->type()) {
|
||||
if ('application/json' == $this->contentType()) {
|
||||
$this->put = (array) json_decode($content, true);
|
||||
} else {
|
||||
parse_str($content, $this->put);
|
||||
@@ -1348,6 +1348,21 @@ class Request
|
||||
return $this->server('REMOTE_PORT');
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前请求 HTTP_CONTENT_TYPE
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function contentType()
|
||||
{
|
||||
$contentType = $this->server('HTTP_CONTENT_TYPE');
|
||||
if ($contentType) {
|
||||
list($type) = explode(';', $contentType);
|
||||
return trim($type);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前请求的路由信息
|
||||
* @access public
|
||||
|
||||
Reference in New Issue
Block a user