How to Routes for Function with parameter? |
I made module with following tree:
module\Blog module\Blog\Config module\Blog\Controller module\Blog\View I put Blog.php inside module\Blog\Controller with 2 below functions: Code: public function index() and below Routes.php inside module\Blog\Controller Code: $routes->get('blog', '\Modules\Blog\Controllers\Blog::index'); when I tried to execute http://localhost/blog ==> its working, but when I try to trigger http://localhost/blog/page/1 ==> return 404 error How to declare the routes to pass Controller's function parameter the right way?
Just replace last '\' to '/'
PHP Code: $routes->get('blog/page/(:num)', '\Modules\Blog\Controllers\Blog::page/$1'); |
Welcome Guest, Not a member yet? Register Sign In |