how to set cookie in kohana framework

2019-09-19 16:59发布

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条回答
Juvenile、少年°
2楼-- · 2019-09-19 17:08

Use this:

Landing_Page_Controller::index();
查看更多
登录 后发表回答