mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进Response类create方法
This commit is contained in:
@@ -69,9 +69,7 @@ class Response
|
|||||||
*/
|
*/
|
||||||
public static function create($data = '', $type = '', $code = 200, array $header = [], $options = [])
|
public static function create($data = '', $type = '', $code = 200, array $header = [], $options = [])
|
||||||
{
|
{
|
||||||
$type = empty($type) ? 'null' : strtolower($type);
|
$class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst(strtolower($type));
|
||||||
|
|
||||||
$class = false !== strpos($type, '\\') ? $type : '\\think\\response\\' . ucfirst($type);
|
|
||||||
if (class_exists($class)) {
|
if (class_exists($class)) {
|
||||||
$response = new $class($data, $code, $header, $options);
|
$response = new $class($data, $code, $header, $options);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user