php - set controller function as link -


i have created simple mvc in php.

my controller :

class front {     function __construct()     {      }     function add_to_cart()     {         echo "123";exit;     } } 

now, want pass id controller.

my view page is:

<a href="http://localhost/bhajipala_latest/controllers/front.php/add_to_cart/<?php echo $pr_value['itemid']; ?>" class="site-button-dark"><span>add cart</span></a> 

so, link have write in href itemid in add_to_cart function?

i'm not sure question simple example of using such functionality

test.php

<?php     echo '<a href="../another_test.php/add_to_cart/?id=1231"/>click here</a>'; ?> 

another_test.php

<?php  class a{      function __construct(){      }     function add_to_cart(){         $id = $_get['id'];         return $id;     } }  $a = new a(); echo $a->add_to_cart();//1231 

Comments