mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
优化App类
This commit is contained in:
@@ -11,8 +11,16 @@
|
|||||||
|
|
||||||
namespace think;
|
namespace think;
|
||||||
|
|
||||||
|
use think\Config;
|
||||||
|
use think\Exception;
|
||||||
use think\exception\HttpResponseException;
|
use think\exception\HttpResponseException;
|
||||||
|
use think\Hook;
|
||||||
|
use think\Lang;
|
||||||
|
use think\Loader;
|
||||||
|
use think\Log;
|
||||||
|
use think\Request;
|
||||||
use think\Response;
|
use think\Response;
|
||||||
|
use think\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App 应用管理
|
* App 应用管理
|
||||||
@@ -137,20 +145,7 @@ class App
|
|||||||
{
|
{
|
||||||
if (empty($vars)) {
|
if (empty($vars)) {
|
||||||
// 自动获取请求变量
|
// 自动获取请求变量
|
||||||
switch (REQUEST_METHOD) {
|
$vars = Request::instance()->param();
|
||||||
case 'POST':
|
|
||||||
$vars = array_merge($_GET, $_POST);
|
|
||||||
break;
|
|
||||||
case 'PUT':
|
|
||||||
static $_PUT = null;
|
|
||||||
if (is_null($_PUT)) {
|
|
||||||
parse_str(file_get_contents('php://input'), $_PUT);
|
|
||||||
}
|
|
||||||
$vars = array_merge($_GET, $_PUT);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$vars = $_GET;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (is_array($method)) {
|
if (is_array($method)) {
|
||||||
$class = is_object($method[0]) ? $method[0] : new $method[0];
|
$class = is_object($method[0]) ? $method[0] : new $method[0];
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class Response
|
|||||||
protected $transform;
|
protected $transform;
|
||||||
// 输出数据
|
// 输出数据
|
||||||
protected $data;
|
protected $data;
|
||||||
|
// 输出类型
|
||||||
protected $type;
|
protected $type;
|
||||||
// 当前的contentType
|
// 当前的contentType
|
||||||
protected $contentType;
|
protected $contentType;
|
||||||
@@ -67,7 +68,7 @@ class Response
|
|||||||
{
|
{
|
||||||
$type = strtolower($type ?: (IS_AJAX ? 'json' : 'html'));
|
$type = strtolower($type ?: (IS_AJAX ? 'json' : 'html'));
|
||||||
if (!isset(self::$instance[$type])) {
|
if (!isset(self::$instance[$type])) {
|
||||||
$class = '\\think\response\\' . ucfirst($type);
|
$class = '\\think\\response\\' . ucfirst($type);
|
||||||
if (class_exists($class)) {
|
if (class_exists($class)) {
|
||||||
$response = new $class($data, $type, $options);
|
$response = new $class($data, $type, $options);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user