protected function _initSession()
{
$config = array();
$config['db'] = array('adapter'=>'PDO_SQLITE',
'params' => array('dbname'=> ROOT.'/data/tmp.db3')
);
$config['SaveHandler'] = array(
'name' => 'sessions', //table name as per Zend_Db_Table
'primary' => array(
'id', //the sessionID given by PHP
'path', //session.save_path
'name', //session name
),
'primaryAssignment' => array(
//you must tell the save handler which columns you
//are using as the primary key. ORDER IS IMPORTANT
'sessionId', //first column of the primary key is of the sessionID
'sessionSavePath', //second column of the primary key is the save path
'sessionName', //third column of the primary key is the session name
),
'modifiedColumn' => 'modified', //time the session should expire
'dataColumn' => 'data', //serialized data
'lifetimeColumn' => 'lifetime', //end of life for a specific record
);
$config['lifetime'] = 60*60*24*30;
$config['options'] = array (
'bug_compat_42' => '',
'bug_compat_warn' => '',
'cache_expire' => '180',
'cache_limiter' => 'nocache',
'cookie_domain' => '',
'cookie_httponly' => '',
'cookie_lifetime' => $config['lifetime'],
'cookie_path' => '/',
'cookie_secure' => '0',
'entropy_file' => '',
'entropy_length' => '0',
'gc_divisor' => '1000',
'gc_maxlifetime' => '1440',
'gc_probability' => '1',
'hash_bits_per_character' => '5',
'hash_function' => '0',
'name' => 'TaMeR_SESSID',
'referer_check' => '',
'save_handler' => 'user',
'save_path' => '',
'serialize_handler' => 'php',
'use_cookies' => '1',
'use_only_cookies' => 'on',
'use_trans_sid' => '0',
'strict' => false,
'remember_me_seconds' => $config['lifetime'],
'throw_startup_exceptions' => true,
);
$db = Zend_Db::factory($config['db']['adapter'], $config['db']['params']);
if(! in_array('sessions', $db->listTables())) {
$sql = "CREATE TABLE sessions (";
$sql .= "id TEXT, ";
$sql .= "path TEXT, ";
$sql .= "name TEXT DEFAULT '', ";
$sql .= "modified INTEGER, ";
$sql .= "lifetime INTEGER, ";
$sql .= "data TEXT, ";
$sql .= "PRIMARY KEY (id, path, name)";
$sql .= ");";
$db->exec($sql);
}
Zend_Db_Table_Abstract::setDefaultAdapter($db);
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config['SaveHandler']));
Zend_Session::setOptions($config['options']);
Zend_Session::start();
}
いくつかのミスを: '$ sessionOptions =配列( 'save_path' =でなければなりません> $ options ['session'] ['save_path'] );および 'Zend_Session :: setOptions($ sessionOptions);' – Wizard