T
T
themailvnk2017-11-07 17:54:54
PHP
themailvnk, 2017-11-07 17:54:54

Why don't cookies work in Phalcon?

The standard function of creating cookies does not work
. What is the problem
5a01c8db7aef5728666260.png5a01c93b6ce9d971113140.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wagoodoogoo, 2019-01-28
@wagoodooogoo

You do not have a predefined cookie service. Or call via Phalcon\Http\Response\Cookies

$cookies = new Phalcon\Http\Response\Cookies();
$cookies->set(
            'remember-me',
            'some value',
            time() + 15 * 86400
        );
or through the service
$di->set(
    'cookies',
    function () {
        $cookies = new Phalcon\Http\Response\Cookies();

        $cookies->useEncryption(false);

        return $cookies;
    }
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question