Kohana_HTTP_Exception [404]:在此服务器上找不到请求的URL行/ ID

时间:2017-07-29 09:24:50

标签: php kohana kohana-3.3

Screenshot of the Error

无法从控制器显示我的方法 id

我试图访问我的方法ID,我收到一个错误。 我错了吗?

<?php defined('SYSPATH')  or die('No Direct Script Access');

Class Controller_Line extends Controller
{
    public function action_index()
    {
       echo "<h1> Demonstration : KOHANA </h1>";
       echo "This is a Line 1.<br>";
       echo "This is a Line 2.<br>";
       echo "This is a Line 3.<br>";
       echo "This is a Line 4.<br>";
    }

    public function id()
    {
      echo "this is method id";
    }
 }

 ?>

1 个答案:

答案 0 :(得分:0)

控制器操作需要以action_为前缀,以便路由器能够调用它。因此该方法需要命名为action_id()