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

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

osacar

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

3281 3 0
3個回答

walkor 打賞

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

  • superbai 2016-05-09

    我在使用PHPSocket.io時,如果是調試模式運行就沒有問題,但是如果用守護進程模式運行的話,數(shù)據(jù)庫就寫不進去,請問walkor遇到過這個問題么?

  • 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;
}
火鳥俊哥哥

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

  • 暫無評論
年代過于久遠,無法發(fā)表回答
??