Article From:https://segmentfault.com/q/1010000011053310
Question:

None of the two ways

Answer 0:

[Update]

. The operation is to get object attributes. If you store an array, you should follow the array.

Array access access methods:{$Think.cookie.admin['username']}

        opcache_reset();
        $arr=['username'=>'ptbird','level'=>1];
        Cookie::set('admin',$arr,3600);
        return $this->fetch();
{$Think.cookie.admin['username']}

The first way won’t get out. You need to see how your cookie is written.

https://www.kancloud.cn/manua…

Answer 1:

https://www.kancloud.cn/manua… You can take a look at the TP5 Development Manual

Answer 2:

All of the three ways can output cookie in the view
1.
{$Think.cookie.name} nameIt’s the key name
2.
{$Request.cookie.name} tp5.0There is no support for such tp3.2 species
3.

{:cookie('name')}

Leave a Reply

Your email address will not be published. Required fields are marked *