PHP code example of colaphp / session
1. Go to this page and download the library: Download colaphp/session 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/ */
colaphp / session example snippets
//配置文件。type驱动 支持Redis|Memcache对应添加host、port即可
$config = [
'id' => '',
'var_session_id' => '',
'prefix' => 'ColaPHP',
'type' => '',
'auto_start' => true,
];
//使用助手函数
session($config);
session('name','hello');
$value = session('name');