国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

官方的demo有使用數(shù)據(jù)庫的完整例子么?

osacar

想學(xué)習(xí)一下如何使用workerman gateway中使用數(shù)據(jù)庫的例子。
看了幾個(gè)項(xiàng)目,好像都沒有用到。比如聊天室。

3166 3 0
3個(gè)回答

walkor 打賞

目前沒有使用數(shù)據(jù)庫的例子。數(shù)據(jù)庫的使用和普通php沒區(qū)別。

  • superbai 2016-05-09

    我在使用PHPSocket.io時(shí),如果是調(diào)試模式運(yùn)行就沒有問題,但是如果用守護(hù)進(jìn)程模式運(yùn)行的話,數(shù)據(jù)庫就寫不進(jìn)去,請(qǐng)問walkor遇到過這個(gè)問題么?

  • walkor 2016-05-09

    新問題開新的帖子吧

aaron0768

我是這么寫的,可以參考下~~

public static function sendOffLineMessage($uid){
    $dbData = Db::instance('dbData');
    $data = $dbData->select('*')->from('chat_log')->where('toUserId= :toUserId')->where('status= :status')->orderBy(array('addTime'))->bindValues(array('toUserId'=>$uid,'status'=>2))->query();
    foreach($data as $v){
        $new_message = array(
            'type'=>'3',
            'targetUserId'=>$v,
            'content'=>$v,
            'addTime'=>$v,
            'contentType'=>$v,
        );
        Gateway::sendToUid($v, json_encode($new_message));
        $dbData->update('chat_log')->cols(array('status'))->where('id='.$v)->bindValue('status',1)->query();
    }
    return;
}
火鳥俊哥哥

樓上的這個(gè)貌似是用了框架的,目前支持原生的mysql語法,不過我感覺用慣了框架,用原生的好不習(xí)慣

  • 暫無評(píng)論
年代過于久遠(yuǎn),無法發(fā)表回答
??