修复$_SERVER["HTTP_ACCEPT"]不存在时的notice错误

This commit is contained in:
Haotong Lin
2015-12-16 21:39:16 +08:00
parent 8b5ee4e688
commit 21e88067cd

View File

@@ -102,6 +102,10 @@ abstract class rest
*/ */
public static function getAcceptType() public static function getAcceptType()
{ {
if (!isset($_SERVER['HTTP_ACCEPT'])) {
return false;
}
$type = [ $type = [
'html' => 'text/html,application/xhtml+xml,*/*', 'html' => 'text/html,application/xhtml+xml,*/*',
'xml' => 'application/xml,text/xml,application/x-xml', 'xml' => 'application/xml,text/xml,application/x-xml',
@@ -127,6 +131,7 @@ abstract class rest
} }
} }
} }
return false; return false;
} }
} }