mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 08:02:48 +08:00
改进App类bindParams方法
This commit is contained in:
@@ -213,10 +213,6 @@ class App
|
|||||||
*/
|
*/
|
||||||
public static function invokeMethod($method, $vars = [])
|
public static function invokeMethod($method, $vars = [])
|
||||||
{
|
{
|
||||||
if (empty($vars)) {
|
|
||||||
// 自动获取请求变量
|
|
||||||
$vars = Request::instance()->param();
|
|
||||||
}
|
|
||||||
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];
|
||||||
$reflect = new \ReflectionMethod($class, $method[1]);
|
$reflect = new \ReflectionMethod($class, $method[1]);
|
||||||
@@ -237,8 +233,12 @@ class App
|
|||||||
* @param array $vars 变量
|
* @param array $vars 变量
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private static function bindParams($reflect, $vars)
|
private static function bindParams($reflect, $vars = [])
|
||||||
{
|
{
|
||||||
|
if (empty($vars)) {
|
||||||
|
// 自动获取请求变量
|
||||||
|
$vars = Request::instance()->param();
|
||||||
|
}
|
||||||
$args = [];
|
$args = [];
|
||||||
// 判断数组类型 数字数组时按顺序绑定参数
|
// 判断数组类型 数字数组时按顺序绑定参数
|
||||||
reset($vars);
|
reset($vars);
|
||||||
|
|||||||
Reference in New Issue
Block a user