From 7718730600fba2b0746c89b543864451b5239a6a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 11 Jul 2016 21:44:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRequest=E7=B1=BB=E7=9A=84put?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8json?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=A7=A3=E6=9E=90=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/think/Request.php b/library/think/Request.php index 3ca8f892..13d43e9d 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -692,7 +692,12 @@ class Request return $this->put = is_null($this->put) ? $name : array_merge($this->put, $name); } if (is_null($this->put)) { - parse_str(file_get_contents('php://input'), $this->put); + $content = file_get_contents('php://input'); + if (strpos($content, '":')) { + $this->put = json_decode($content, true); + } else { + parse_str($content, $this->put); + } } return false === $name ? $this->put : $this->input($this->put, $name, $default, $filter); }