改进Request类contentType方法

This commit is contained in:
thinkphp
2017-02-22 11:27:07 +08:00
parent 365b2a36aa
commit e482cbe7e8

View File

@@ -1357,7 +1357,11 @@ class Request
{
$contentType = $this->server('CONTENT_TYPE');
if ($contentType) {
list($type) = explode(';', $contentType);
if (strpos($contentType, ';')) {
list($type) = explode(';', $contentType);
} else {
$type = $contentType;
}
return trim($type);
}
return '';