2014-07-17 108 views
-1

我想在kohana框架中設置和獲取cookie,但我不知道如何在我的控制器中調用類cookie。如何在kohana框架中設置cookie

<?php 
class Landing_Page_Controller extends Controller { 
    public function __construct() { 
     parent::__construct(); 
    } 

    public function index() { 
     setcookie("kohanaSalt", "testKohanadata" , time()+3600); 
    } 
} 
?> 

以上是一個簡單的方法來設置從PHP一個cookie,但我想設置這個cookie,會話,並可能會使用Kohana的,如果它的可能。

回答

0

使用此:

Landing_Page_Controller::index(); 
+0

你的意思是這在我的索引操作 –

+0

這意味着您所呼叫的Landing_Page_Controller類中的索引()函數添加到 –