PHP code example of homevip / cookie

1. Go to this page and download the library: Download homevip/cookie library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

homevip / cookie example snippets


    $Cookie = Cookie::instance();

    // 存储
    $Cookie->set('key', 'test', [
        'expire' => 60 * 10
    ]);

    // 修改
    $Cookie->update('key', '李四', [
        'expire' => 60 * 10
    ]);

    // 删除
    $Cookie->del('key');

    // 删除全部
    $Cookie->delAll();

    // 读取
    $Cookie->get('key');