I'm writing a custom MVC framework for a PHP project and everything is great until it comes to getting arguments from the URL route. I'm stuck on passing parts of the URL route into a function argument dynamically. I already have a method which is just to implode the route and use the array for the function arguments but I would really like to know how to do it like in CodeIgnitor or CakePHP.
Here's what i want to have done. The site url would be...
url: http://yoursite.com/profile/view/35/foo
and in my controller I would have...
<?php
Class profileController Extends baseController
{
public function view($ID, $blah)
{
echo $ID; //would show 35
echo $blah; //would show foo
}
}
?>
I would really like to know how this is done. Thanks a lot!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…