phalcon cookies

<?php

class SessionController extends Phalcon\Mvc\Controller
{
    public function loginAction()
    {
        //检测cookie之前有没被设置过
        if ($this->cookies->has('remember-me')) {

            //获取cookie
            $rememberMe = $this->cookies->get('remember-me');

            //获取cookie的值
            $value = $rememberMe->getValue();

        }
    }

    public function startAction()
    {
        $this->cookies->set('remember-me', 'some value', time() + 15 * 86400);
    }
}

这个例子设置cookie和获取cookie都不行啊

In your loginAction all I can see is that you're getting the cookie. That means you have to first call startAction to set your cookie.

I see you're following https://docs.phalconphp.com/en/latest/reference/cookies.html

I have to warn you that is just an example and not secure enough for persistent sessions.



13.0k

有问题可以加我发我邮箱[email protected]或者qq 525695314



1.4k

$this->cookies->send();