ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
#### 创建协程 ~~~ go(function () { co::sleep(0.5); echo "hello"; }); go("test"); go([$object, "method"]); ~~~ <br> #### 通道操作 ~~~ $c = new chan(1); $c->push($data); $c->pop(); ~~~ <br> #### 协程客户端 ~~~ $redis = new Co\Redis; $mysql = new Co\MySQL; $http = new Co\Http\Client; $tcp = new Co\Client; $http2 = new Co\Http2\Client; ~~~ <br> #### 其他 API ~~~ co::sleep(100); co::fread($fp); co::gethostbyname('www.baidu.com'); ~~~ <br> #### 延迟执行 ~~~ defer(function () use ($db) { $db->close(); }); ~~~