phpkohanakohana-3.3

Kohana_HTTP_Exception [ 404 ]: The requested URL Line/id was not found on this server


Screenshot of the Error

Unable to Display my method id from the controller .

i tried to access my method id and i get an error . Am i going somewhere wrong ?

<?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";
    }
 }

 ?>

Solution

  • Controller actions needs to be prefixed with action_ for the router to be able to call it. So the method needs to be named action_id().