<?php
namespace app\index\controller;
require_once 'GatewayClient/Gateway.php';
// GatewayClient 3.0.0版本開始要使用命名空間
use GatewayClient\Gateway;
use think\Controller;
class Sendmsg extends Controller
{
public function index()
{
// 向任意uid的網(wǎng)站頁面發(fā)送數(shù)據(jù)
/*Gateway::sendToClient('7f0000010b540000001f',json_encode(array(
'type' => 'send',
'client_id' => 'this is ending all'
)));//單個Client推送成功*/
//$count = Gateway::isOnline('7f0000010b540000001d');
Gateway::sendToAll(json_encode(array(
'type' => 'send',
'client_id' => 'this is ending all'
)));//報錯stream_socket_client():
//return $this->fetch();
}
}
?>
為什么會報報錯???
看起來是tp框架把錯誤給吃掉了,把代碼挪出來不用tp框架估計就有具體報錯了。
那個if($client){....}里的$err_msg看起來是具體的報錯,但是沒能有機(jī)會運(yùn)行到那里