Ejemplo n.º 1
0
 private static function __actionMatching($actionFn)
 {
     $_requestUri = X::getEnv('request_uri');
     $_controller = X::getEnv('controller');
     $_action = X::getEnv('action');
     list($actionRegular, $fn) = $actionFn;
     //csrf
     if (X::getEnv('request_method') === 'POST' && X::getEnv('csrf')) {
         self::__csrf();
     }
     $actionRegular = self::__waysCorrect($actionRegular);
     //匹配 query uri 获取参数传递到回调闭包里面
     if (preg_match('/^' . addcslashes($actionRegular, "/") . '$/i', $_action, $matchs)) {
         X::setEnv('queryUriRegular', $actionRegular);
         array_shift($matchs);
         call_user_func_array($fn, $matchs);
         exit;
     }
 }