This commit is contained in:
thinkphp
2017-03-02 11:37:13 +08:00
parent b7eb24749f
commit 7a7ebee5c1

View File

@@ -120,7 +120,7 @@ class App
// 请求缓存检查 // 请求缓存检查
$request->cache($config['request_cache'], $config['request_cache_expire'], $config['request_cache_except']); $request->cache($config['request_cache'], $config['request_cache_expire'], $config['request_cache_except']);
$data = self::exec($dispatch,$config); $data = self::exec($dispatch, $config);
} catch (HttpResponseException $exception) { } catch (HttpResponseException $exception) {
$data = $exception->getResponse(); $data = $exception->getResponse();
} }
@@ -234,9 +234,9 @@ class App
} }
$args = []; $args = [];
if ($reflect->getNumberOfParameters() > 0) { if ($reflect->getNumberOfParameters() > 0) {
// 判断数组类型 数字数组时按顺序绑定参数 // 判断数组类型 数字数组时按顺序绑定参数
reset($vars); reset($vars);
$type = key($vars) === 0 ? 1 : 0; $type = key($vars) === 0 ? 1 : 0;
$params = $reflect->getParameters(); $params = $reflect->getParameters();
foreach ($params as $param) { foreach ($params as $param) {
$args[] = self::getParamValue($param, $vars, $type); $args[] = self::getParamValue($param, $vars, $type);
@@ -266,8 +266,7 @@ class App
if (method_exists($className, 'invoke')) { if (method_exists($className, 'invoke')) {
$method = new \ReflectionMethod($className, 'invoke'); $method = new \ReflectionMethod($className, 'invoke');
if ($method->isPublic() && $method->isStatic()) { if ($method->isPublic() && $method->isStatic()) {
$result = $className::invoke(Request::instance()); return $className::invoke(Request::instance());
continue;
} }
} }
$result = method_exists($className, 'instance') ? $className::instance() : new $className; $result = method_exists($className, 'instance') ? $className::instance() : new $className;