mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进
This commit is contained in:
@@ -688,7 +688,7 @@ class Request
|
|||||||
{
|
{
|
||||||
if (empty($this->post)) {
|
if (empty($this->post)) {
|
||||||
$content = $this->input;
|
$content = $this->input;
|
||||||
if (empty($_POST) && 'json' == $this->type()) {
|
if (empty($_POST) && 'application/json' == $this->contentType()) {
|
||||||
$this->post = (array) json_decode($content, true);
|
$this->post = (array) json_decode($content, true);
|
||||||
} else {
|
} else {
|
||||||
$this->post = $_POST;
|
$this->post = $_POST;
|
||||||
@@ -713,7 +713,7 @@ class Request
|
|||||||
{
|
{
|
||||||
if (is_null($this->put)) {
|
if (is_null($this->put)) {
|
||||||
$content = $this->input;
|
$content = $this->input;
|
||||||
if ('json' == $this->type()) {
|
if ('application/json' == $this->contentType()) {
|
||||||
$this->put = (array) json_decode($content, true);
|
$this->put = (array) json_decode($content, true);
|
||||||
} else {
|
} else {
|
||||||
parse_str($content, $this->put);
|
parse_str($content, $this->put);
|
||||||
@@ -1348,6 +1348,21 @@ class Request
|
|||||||
return $this->server('REMOTE_PORT');
|
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
|
* @access public
|
||||||
|
|||||||
Reference in New Issue
Block a user