A
A
Artem2016-08-04 21:01:35
Twig
Artem, 2016-08-04 21:01:35

How to work with setcookie in Twig?

Guys, started working with Twig. There was a problem with cookies and session (Warning: Cannot modify header information - headers already sent by).
There was no such thing before (CMS / engine is mine, self-written), I switch to Twig.
Having figured it out, I realized that setcookie was fooling my head. Question: How to work with setcookie in Twig ?
Close bracket error:

setcookie(
        "gkl",         
        $VisitUser,        
        time()+2*24*60*60,     
        "/"                   
    );

There is also an error on closing brackets:
echo $twig->render('index.html', array('title' => $title,
                     'description' => $description,
                     'keywords' => $keywords,
 ));

Thanks for any hints and hints.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2016-08-15
@webog

Hmm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question