Exemplo n.º 1
0
 public function __construct()
 {
     // 去除RequstURI之前的多余的字符
     $request_uri = substr($_SERVER['REQUEST_URI'], 1);
     $requst_array = explode('?', $request_uri);
     // 确定请求参数
     $request_params = $this->getRequestParams($requst_array[0]);
     // 确定请求路径
     $request_route = $this->getRequestRoute($requst_array[1]);
     // 确定web_root和framework_root
     $framework_root = dirname(dirname($_SERVER['SCRIPT_FILENAME'])) . DIRECTORY_SEPARATOR . FMWNAME;
     if (empty($request_route)) {
         $request_route[] = DefaultModuleAction;
         $request_route[] = DefaultMethodAction;
     }
     $ajax = '';
     if (isset($request_params['_ajax_']) && $request_params['_ajax_'] == 1) {
         $ajax = "Ajax_";
     }
     Cemvc_App_Register::getInstance();
     Cemvc_App_Register::set('request_params', $request_params);
     Cemvc_App_Register::set('request_route', $request_route);
     // 初始化mvc
     $controller = "Controller_" . $request_route[0];
     $action = $ajax . $request_route[1];
     self::$controller_name = $request_route[0];
     self::$action_name = $action;
     self::$controller = new $controller();
     ob_start();
     self::$controller->{self::$action_name}();
     ob_end_flush();
     /**
      * $Obj=new $this->ClassName;
      * $Obj->{$this->MethodAction}();
      */
     //-----------------------sunyuw writen------------------//
 }