how to set cookie in kohana framework

北慕城南 提交于 2019-12-13 08:29:58

问题


I am trying to set and get a cookie in kohana framework, but I don't know how to call the class cookie in my controller.

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

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

The above is a simple way to set a cookie from php, but I want to set this cookie into session and do so using kohana, if its possible.


回答1:


Use this:

Landing_Page_Controller::index();


来源:https://stackoverflow.com/questions/24802610/how-to-set-cookie-in-kohana-framework

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!