改进Response类create方法 支持自定义子类的命名空间位置

This commit is contained in:
thinkphp
2016-05-19 13:36:10 +08:00
parent efb65117ad
commit e5de35ed43

View File

@@ -68,7 +68,7 @@ class Response
{
$type = strtolower($type ?: (IS_AJAX ? 'json' : 'html'));
if (!isset(self::$instance[$type])) {
$class = '\\think\\response\\' . ucfirst($type);
$class = (isset($options['namespace']) ? $options['namespace'] : '\\think\\response\\') . ucfirst($type);
if (class_exists($class)) {
$response = new $class($data, $type, $options);
} else {