セッションデータをデータベースに保存しています。クラスSessionには、データの保存と取得に使用されるストレージ関数があります。
今私の質問は次のとおりです。
デフォルトが「files」に設定されているため、ランタイム構成でsession.save_handlerの値を変更する必要がありますか、それとも関数session_set_save_handlerがそれをオーバーライド(無視)しますか?
そして、session.auto_startが有効になっている場合、どのハンドラーが使用されますか?
これが私のクラスセッションの最小化されたバージョンです:
class Session
{
public function __construct($registry, $sessionhash = '', $userid = 0, $password = '')
{
$this->config = cl_Config::instance();
$this->db = cl_Database::instance($this->config);
$this->hasher = cl_Hasher::instance();
// Register this object as the session handler
session_set_save_handler(
array( $this, "open" ),
array( $this, "close" ),
array( $this, "read" ),
array( $this, "write"),
array( $this, "destroy"),
array( $this, "gc" )
);
function open( $save_path, $session_name )
{
...
return true;
}
function close( $save_path, $session_name )
{
...
return true;
}
function read( $id )
{
...
}
function write( $id, $data )
{
...
return true;
}
...