改进Request类的put方法 支持使用json格式解析变量

This commit is contained in:
thinkphp
2016-07-11 21:44:00 +08:00
parent cd747fa49b
commit 7718730600

View File

@@ -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);
}