写入Session
@access public
@param string $sessID
@param String $sessData
968478
public function write($sessID,$sessData) { 
       $hander 		= 	is_array($this->hander)?$this->hander[0]:$this->hander;
       $expire 		= 	time() + $this->lifeTime; 
       $sessData 	= 	addslashes($sessData);
       mysql_query('REPLACE INTO  '.$this->sessionTable." (  session_id, session_expire, session_data)  VALUES( '$sessID', '$expire',  '$sessData')",$hander); 
       if(mysql_affected_rows($hander)) 
           return true; 
       return false; 
   }
1201270
public function open($savePath, $sessName)
    {
        $this->lifeTime = C('SESSION_EXPIRE') ? C('SESSION_EXPIRE') : ini_get('session.gc_maxlifetime');
        $this->sessionTable = C('SESSION_TABLE') ? C('SESSION_TABLE') : C("DB_PREFIX") . "session";
        //分布式数据库
        $host = explode(',', C('DB_HOST'));
        $port = explode(',', C('DB_PORT'));
        $name = explode(',', C('DB_NAME'));
        $user = explode(',', C('DB_USER'));
        $pwd = explode(',', C('DB_PWD'));
        if (1 == C('DB_DEPLOY_TYPE')) {
            //读写分离
            if (C('DB_RW_SEPARATE')) {
                $w = floor(mt_rand(0, C('DB_MASTER_NUM') - 1));
                if (is_numeric(C('DB_SLAVE_NO'))) {//指定服务器读
                    $r = C('DB_SLAVE_NO');
                } else {
                    $r = floor(mt_rand(C('DB_MASTER_NUM'), count($host) - 1));
                }
                //主数据库链接
                $hander = mysqli_connect(
                    $host[$w] . (isset($port[$w]) ? ':' . $port[$w] : ':' . $port[0]),
                    isset($user[$w]) ? $user[$w] : $user[0],
                    isset($pwd[$w]) ? $pwd[$w] : $pwd[0]
                );
                $dbSel = mysqli_select_db(
                    $hander,
                    isset($name[$w]) ? $name[$w] : $name[0]
                );
                if (!$hander || !$dbSel)
                    return false;
                $this->hander[0] = $hander;
                //从数据库链接
                $hander = mysqli_connect(
                    $host[$r] . (isset($port[$r]) ? ':' . $port[$r] : ':' . $port[0]),
                    isset($user[$r]) ? $user[$r] : $user[0],
                    isset($pwd[$r]) ? $pwd[$r] : $pwd[0]
                );
                $dbSel = mysqli_select_db(
                    $hander,
                    isset($name[$r]) ? $name[$r] : $name[0]
                );
                if (!$hander || !$dbSel)
                    return false;
                $this->hander[1] = $hander;
                return true;
            }
        }
        //从数据库链接
        $r = floor(mt_rand(0, count($host) - 1));
        $hander = mysqli_connect(
            $host[$r] . (isset($port[$r]) ? ':' . $port[$r] : ':' . $port[0]),
            isset($user[$r]) ? $user[$r] : $user[0],
            isset($pwd[$r]) ? $pwd[$r] : $pwd[0]
        );
        $dbSel = mysqli_select_db(
            $hander,
            isset($name[$r]) ? $name[$r] : $name[0]
        );
        if (!$hander || !$dbSel)
            return false;
        $this->hander = $hander;
        return true;
    }
1304442
public function session(array $data)
    {
        $this->startSession();

        foreach ($data as $key => $value) {
            $this->app['session']->put($key, $value);
        }
    }
1108807
public function destroy($sessID)
    {
        $hander = is_array($this->hander) ? $this->hander[0] : $this->hander;
        mysqli_query($hander, "DELETE FROM " . $this->sessionTable . " WHERE session_id = '$sessID'");
        if (mysqli_affected_rows($hander))
            return true;
        return false;
    }
552461
public static function GetInstanceDataFromSession($sListSessionKey)
    {
        if (!array_key_exists(TdbShopArticleList::SESSIN_DUMP_NAME, $_SESSION)) {
            $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME] = array();
        }
        $aList = null;
        if (array_key_exists($sListSessionKey, $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME])) {
            $aList = $_SESSION[TdbShopArticleList::SESSIN_DUMP_NAME][$sListSessionKey];
        }

        return $aList;
    }
59154
public function create($data, $tokenId = null)
    {
        if (isset($tokenId)) {
            return $this->client()->put($data, 'sessions/{tokenId}', ['tokenId' => $tokenId]);
        }

        return $this->client()->post($data, 'sessions');
    }
321206
function loadFromSession($name = '') {
		if(!$name) $name = $this->owner->FormName();

		$formSession = \Session::get("FormInfo.{$name}.data");
		if($formSession) $this->owner->loadDataFrom($formSession);
	}
727740
public function write($sessionid, $sessiondata)
    {
        $adapter = $this->getAdapter();

        $data = [
          'time' => time(),
          'data' => $sessiondata
        ];

        if ($adapter instanceof PostgreSQL) {
            $data['data'] = bin2hex($data['data']);
        }

        $sess = $this->getDbData($sessionid);

        if ($this->disableLog) {
            Log::temporaryDisable('sql');
        }

        if ($sess === null) {
            // the record doesn't exists in database, lets insert it
            $data['id'] = $sessionid;

            try {
                $adapter->insert($this->getTableName(), $data)->exec();
                return true;

            } catch (DbException $e) {
                Log::emergency($e);
                return false;

            } finally {
                if ($this->disableLog) {
                    Log::restoreTemporaryDisablement();
                }

            }

        } else {
            // the record data already exists in db

            try {
                $adapter->update($this->getTableName(), $data)->where('id', $sessionid)->exec();
                return true;

            } catch (DbException $e) {
                Log::emergency($e);
                return false;

            } finally {
                if ($this->disableLog) {
                    Log::restoreTemporaryDisablement();
                }

            }
        }
    }
1323308
final public function write($sessId, $data = array())
    {

        //Writes user data to the db;
        $self = $this;

        //expires
        $expires = time() + $self->life;

        //Sets the cookie
        //$output->setCookie($self->cookie, $sessId."0".$data['token'], $expires);
        //$output->setCookie($sessId, $data['token'], $expires);
        $cookie = session_get_cookie_params();

        //Cookie parameters
        session_set_cookie_params($expires, $cookie['path'], $cookie['domain'], true);

        $self->id = session_id();
        $userdata = $this->input->serialize($self->registry);

        //last modified = now;
        //expires = now + life ;
        $handler = $this->handler;

        if (!$handler->write($userdata, $data, $self, $sessId, $expires)) {
            return false;
        }

        return true;
    }
1088858
public void createSession(String sessionId) {
        boolean newSession = sessionId == null;
        sessionId = newSession ? newSessionId() : sessionId;
        SessionController controller = sessions.get(sessionId);
        
        if (controller == null) {
            controller = SessionController.create(sessionId, newSession);
            sessions.put(sessionId, controller);
        }
    }
480547
public function write($sessionId, $data): bool
    {
        $sql = 'REPLACE INTO sessions VALUES(:id, :id_user, NOW(), :content)';
        $params = ['id' => $sessionId, 'id_user' => $this->userId, 'content' => $data];

        return $this->db->exec($sql, $params);
    }
201615
@Override
    public Session createSession(boolean transacted, int acknowledgeMode) throws JMSException {
        connectionLock.readLock().lock();
        try {
            ManagedSession managedSession = new ManagedSession(
                    getConnection().createSession(transacted, acknowledgeMode),
                    transacted,
                    acknowledgeMode,
                    connectionDefinition.isJeeMode(),
                    this);
            sessions.add(managedSession);
            return managedSession;
        } finally {
            connectionLock.readLock().unlock();
        }
    }
1371873
public function initSessionData(string $sessionId): void
    {
        $data = [
            'uid' => 0,
            'session_data' => [],
            'expired_at' => time() + $this->sessionLife,
            'updated_at' => time()
        ];
        $this->isNew = true;
        $this->destroyed = false;
        $this->commited = false;
        if (($sessionId != '') && $this->checkSessionExists($sessionId)) {
            $this->isNew = false;
            $data = $this->loadSessionData($sessionId);
        } else {
            do {
                $sessionId = $this->makeSessionId();
            } while ($this->checkSessionExists($sessionId));
        }
        $attributes = [
            'uid' => $data['uid'],
            'expired_at' => $data['expired_at'],
            'updated_at' => $data['updated_at'],
            'session_id' => $sessionId
        ];
        $sessionData = $data['session_data'];
        $this->sessionAttributes = new ObserverData($attributes);
        $this->sessionData = new ObserverData($sessionData);
    }
958074
public function addRegister($sUserId, $sResult)
    {
        $this->_registerUser = md5($sUserId);
        $this->_registerResult = $sResult;
    }
465621
final public function update($sessId, $userdata = array())
    {

        if (empty($sessId)) {
            return false;
        }

        $self = $this;

        //updates a started session for exp time
        //stores data for the registry
        $now = time();
        $newExpires = $now + $self->life;

        $update = array(
            "session_lastactive" => $now,
            "session_expires" => $newExpires
        );
        $self->id = $sessId;

        //If isset registry and is not empty, store userdata;
        if (isset($self->registry) && is_array($self->registry)) {
            $userdata = $this->input->serialize($self->registry);
            $update["session_registry"] = $userdata;
        }
        //Read the session
        $handler = $this->handler;
        //Must be called before the sesion start to generate the Id
        session_id($sessId);
        //session_start();

        if (!$handler->update($update, $self, $self->id)) {
            return false;
        }

        return true;
    }
929330
public function do_write($session_id, $data, $ttl)
    {
        /** @var \ManaPHP\DbInterface $db */
        $db = $this->_di->getShared($this->_db);

        $field_values = [
            'user_id' => $this->identity->getId(0),
            'client_ip' => $this->request->getClientIp(),
            'data' => $data,
            'updated_time' => time(),
            'expired_time' => $ttl + time()
        ];

        if ($db->query($this->_source)->exists()) {
            $db->update($this->_source, $field_values, ['session_id' => $session_id]);
        } else {
            $field_values['session_id'] = $session_id;
            $db->insert($this->_source, $field_values);
        }

        return true;
    }
336920
public function write($sessionId, $sessionData): bool
    {
        $identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);

        $content = $this->cryptProvider->encryptSessionData($sessionId, $sessionData);

        try {
            $this->storageDriver->save($identifier, $content);
            return true;
        } catch (Exception $e) {
            return false;
        }
    }