本文整理匯總了PHP中Gateway::sendToAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gateway::sendToAll方法的具體用法?PHP Gateway::sendToAll怎麽用?PHP Gateway::sendToAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gateway
的用法示例。
在下文中一共展示了Gateway::sendToAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: pushMessage
public function pushMessage($toUids, $data)
{
$clients = $this->getClientByUser($toUids);
if ($clients) {
if (!class_exists('Gateway', false)) {
require ADDON_PATH . '/library/GatewayClient/Gateway.php';
}
foreach ($data as &$rs) {
$rs['message_id'] = (int) $rs['message_id'];
$rs['from_uid'] = (int) $rs['from_uid'];
$rs['room_id'] = (int) $rs['list_id'];
$rs['mtime'] = (int) $rs['mtime'];
$rs['from_uname'] = (string) getUserName($rs['from_uid']);
if (isset($rs['attach_id'])) {
$rs['attach_id'] = @desencrypt($rs['attach_id'], C('SECURE_CODE'));
}
$rs['content'] = $this->htmlDecode($rs['content']);
if (isset($rs['location'])) {
$rs['location'] = $this->htmlDecode($rs['location']);
}
if (isset($rs['title'])) {
$rs['title'] = $this->htmlDecode($rs['title']);
}
unset($rs['list_id']);
}
$data = json_encode(array('type' => 'push_message', 'result' => array('from' => 'web', 'length' => count($data), 'list' => $data), 'status' => 0, 'msg' => ''));
Gateway::sendToAll($data, $clients);
}
}
示例2: actionGateway
public function actionGateway()
{
//var_dump( Yii::app()->request->baseUrl.'/protected/components/Config/Store.php');exit;
var_dump(Gateway::getOnlineStatus());
$store = Store::instance('wymenu');
$printData = $store->get('0000000012');
var_dump($printData);
exit;
$ret = $store->set('0000000012', '上海灘的愛している222');
echo "ddd";
//Gateway::sendToAll(json_encode(array(a=>"上海灘的愛している",b=>"ddddd11111:")));
Gateway::sendToAll('{"a":"上海灘的愛している","b":"ddddd11111:"}');
echo "eee";
}