Php simple router php resolution address
PHP code
Module = $ url [1]; $ this-> action = isset ($ url [2]) &! Empty ($ url [2])? $ Url [2]: $ this-> action;} else {$ this-> module = $ this-> action;} if ($ this-> r = false) {$ made = array ('module' => $ this-> module, 'Action' => $ this-> action,); return $ this-> getObject ($ made, 'webapp');} else {return $ this-> rewrite ($ this-> module, $ this-> action );}} /*** re-define the framework rewrite rule ** @ access private * @ param string $ mod controller name * @ param string $ action requested operation * @ param string $ route rule file * @ ret Urn array */private function rewrite ($ mod, $ action) {$ file = $ this-> route (); require $ file; $ url = '/'. trim (_ URI _,'/'). '/'; if (isset ($ rules) {foreach ($ rules as $ key => $ val) {if (preg_match ($ val [0], $ url )) {$ mod = isset ($ val [1] ['mod'])? $ Val [1] ['mod']: $ mod; $ action = isset ($ val [1] ['action'])? $ Val [1] ['action']: $ action;} foreach ($ val [2] as $ key => $ value) {if (! (Strpos ($ value, '#') = FALSE) {preg_match ("$ value", $ url, $ result ); $ param [$ key] = isset ($ result [1])? $ Result [1]: '';} else {$ param [$ key] = $ value ;}}}$ made = array ('module' => $ mod, 'action' => $ action, 'param' => $ param); return $ this-> getObject ($ made, 'webapp ');}}