private static function parseurl()
 {
     if (isset($_REQUEST['act']) && isset($_REQUEST['mod'])) {
         $act = ucfirst(trim($_REQUEST['act']) . 'Action');
         $method = trim($_REQUEST['mod']);
     } else {
         $act = 'IndexAction';
         $method = 'index';
     }
     if (isset($_REQUEST['app']) && !defined('APP_NAME')) {
         define('APP_NAME', trim($_REQUEST['app']));
     }
     if (CREATE_DEMO) {
         //if need create demo
         $demo = new Demo();
         $demo->run();
     }
     if (!class_exists($act)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ' not find. ');
         } else {
             location();
         }
     }
     $controller = new $act();
     if (!method_exists($controller, $method)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ', method: ' . $method . ' not find. ');
         } else {
             location();
         }
     }
     self::$controller_obj = $controller;
     $controller->method = $method;
     $controller->open_token = OPEN_TOKEN;
     $controller->act = str_ireplace('Action', '', $act);
     self::$act = $controller->act;
     self::$mod = $method;
     $controller->{$method}();
 }
Example #2
0
 private static function parseurl()
 {
     if (isset($_REQUEST['act']) && !empty($_REQUEST['act'])) {
         $act = ucfirst(trim($_REQUEST['act']) . 'Action');
     } else {
         $act = 'IndexAction';
     }
     if (isset($_REQUEST['mod']) && !empty($_REQUEST['mod'])) {
         $method = trim($_REQUEST['mod']);
     } else {
         $method = 'Index';
     }
     if (CREATE_DEMO) {
         //if need create demo
         $demo = new Demo();
         $demo->run();
     }
     if (!class_exists($act)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ' not find. ');
         } else {
             //record log
             SL('controller not find', '访问的controller: ' . $act . ' class not find', '访问日志', 1);
             location();
         }
     }
     self::$controller_obj =& $controller;
     self::$act = str_ireplace('Action', '', $act);
     self::$mod = $method;
     $controller = new $act();
     if (!method_exists($controller, $method)) {
         if (APP_DEBUG) {
             die('controller class: ' . $act . ', method: ' . $method . ' not find. ');
         } else {
             //record log
             SL('method not find', '访问的controller: ' . $act . ' class method: ' . $method . ' not find', '访问日志', 1);
             location();
         }
     }
     $controller->method = $method;
     $controller->open_token = OPEN_TOKEN;
     $controller->act = self::$act;
     $controller->{$method}();
 }