简体   繁体   English

无法使FuelPHP操作运行

[英]Cannot get FuelPHP action to run

I'm new to FuelPHP and I did a little coding with it! 我是FuelPHP的新手,我为此做了一些编码! What I did was create a simple controller and created two methods. 我所做的是创建一个简单的控制器并创建了两个方法。 One for action_index() and the other is action_add(). 一个用于action_index(),另一个用于action_add()。 the code is given below. 代码如下。 Views are already in the app\\views\\ folder. 视图已经在app \\ views \\文件夹中。

 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 但是当我提供以下URL时

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

the method doesn't get called! 该方法不会被调用! A 404 error is give saying 出现404错误

 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. 您已将root设置为student控制器,但这并不意味着所有流量都通过该控制器。 Try visiting: http://localhost/project/public/student/add/ 尝试访问: http://localhost/project/public/student/add/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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