echo ''; $data = Array ( "/book/:id/:category/:keyname" => "/book/12345/php/this-is-a-test-keyname", "/book-:id/:category/:keyname" => "/book-12345/php/this-is-a-test-keyname", "/book/:id_:category~:keyname" => "/book/12345_php~this-is-a-test-keyname", ); foreach ($data as $rule => $uri) { $reRule = preg_replace('/:([a-z]+)/', '(?P<\1>[^/]+)', $rule); $reRule = str_replace('/', '\/', $reRule); preg_match('/' . $reRule .'/', $uri, $matches); print_r($matches); echo '';
'; } echo '
Thursday, November 17, 2011
Create custom router url
Posted by
Unknown
at
3:14 PM
to create friendly url to must using custom router .
This code is really useful for mvc framework like zend, codeignitor,..
This is the code:
Subscribe to:
Post Comments (Atom)