16 lines
486 B
PHP
16 lines
486 B
PHP
<?php
|
|
$path = './tmp/';
|
|
// 判断给定的session存储位置是否存在,不存在则创建对应文件夹
|
|
if (!file_exists($path)) {
|
|
mkdir($path, 0777, true);
|
|
}
|
|
session_save_path($path);
|
|
session_cache_limiter('private');
|
|
$cache_limit = session_cache_limiter();
|
|
session_cache_expire(30);
|
|
$cache_expire = session_cache_expire();
|
|
echo 'The cache limit is ' . $cache_limit . '<br>';
|
|
echo 'The cache expire is ' . $cache_expire . '<br>';
|
|
session_start();
|
|
$_SESSION['username'] = true;
|