tp5.1 使用swoole问题

浏览:1609 发布日期:2020/05/28 分类:ThinkPHP5专区
安装的think-swoole,开启了swoolehttp服务器。为什么在执行的过程中必须要echo上面的链式操作go里面的才能运行,随便echo 1 是不行的,并且Db类通过use关键字传进去也是不能用的,谁能给解答一下,非常感谢 public function index(){
        echo Db::name('users')->fetchSql(true)->where('id',1)->update(array('birthday'=>date('Y-m-d H:i:s')));
        \Swoole\Runtime::enableCoroutine($flags = SWOOLE_HOOK_ALL);
        for ($i = 0; $i < 15000;$i++){
           go(function () use ($i){
               Db::name('users')->where('id',$i)->update(array('username'=>'cccccc'));
           });
        }
        return json([]);
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>