简体   繁体   中英

Cannot get FuelPHP action to run

I'm new to FuelPHP and I did a little coding with it! What I did was create a simple controller and created two methods. One for action_index() and the other is action_add(). the code is given below. Views are already in the app\\views\\ folder.

 class Controller_Student extends Controller
{
    public function action_index()
    {
        return Response::forge(View::forge('index'));
    }

    public function action_add()
    {
        return Response::forge(View::forge('select'));
    }
}

I've set the root to this controller class. When I run the application the index works fine and loads the directed view. But when I give the following URL

 http://localhost/project/public/add/

the method doesn't get called! A 404 error is give saying

 You can see this page because the URL you are accessing cannot be found.

What Am I doing wrong here. I've gone through every documentation, tutorial I find but I shouldn't get this type of an error. Please help me.

Below is the routing file code :

   return array(
'_root_'  => 'student',  // The default route
'_404_'   => 'welcome/404',    // The main 404 route
);

You've set the root to student controller, but that doesn't mean all traffic goes through that controller. Try visiting: http://localhost/project/public/student/add/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM