次のメソッドはルーティングの役割を果たします。このプロセスはどのように完了しますか?
/**<br /> * 控制器调度<br /> *<br /> */<br /> private static function control(){<br /> //二级域名<br /> //var_dump($GLOBALS['setting_config']['enabled_subdomain']);<br /> if ($GLOBALS['setting_config']['enabled_subdomain'] == '1' && $_GET['act'] == 'index' && $_GET['op'] == 'index'){<br /> $store_id = subdomain();<br /> if ($store_id > 0) $_GET['act'] = 'show_store';<br /> }<br /> $act_file = realpath(BASE_PATH.'/control/'.$_GET['act'].'.php');<br /> $class_name = $_GET['act'].'Control';<br /> //echo $act_file;<br /> if ([email protected]($act_file)){<br /> if (C('debug')) {<br /> throw_exception("Base Error: access file isn't exists!");<br /> } else {<br /> showMessage('抱歉!您访问的页面不存在','','html','error');<br /> }<br /> }<br /> if (class_exists($class_name)){<br /> $main = new $class_name();<br /> $function = $_GET['op'].'Op';<br /> if (method_exists($main,$function)){<br /> $main->$function();<br /> }elseif (method_exists($main,'indexOp')){<br /> $main->indexOp();<br /> }else {<br /> $error = "Base Error: function $function not in $class_name!";<br /> throw_exception($error);<br /> }<br /> }else {<br /> $error = "Base Error: class $class_name isn't exists!";<br /> throw_exception($error);<br /> }<br /> }
<br />$act_file = realpath(BASE_PATH.'/control/'.$_GET['act'].'.php');<br />$class_name = $_GET['act'].'Control';<br />
<br />if (class_exists($class_name)){<br /> $main = new $class_name();<br /> $function = $_GET['op'].'Op';<br /> if (method_exists($main,$function)){<br /> $main->$function();<br /> }elseif (method_exists($main,'indexOp')){<br /> $main->indexOp();<br /> }else {<br /> $error = "Base Error: function $function not in $class_name!";<br /> throw_exception($error);<br /> }<br /> }<br />