本文整理匯總了PHP中Wechat::sendMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wechat::sendMessage方法的具體用法?PHP Wechat::sendMessage怎麽用?PHP Wechat::sendMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Wechat
的用法示例。
在下文中一共展示了Wechat::sendMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _log
<?php
include './qy-sdk/qywechat.class.php';
function _log($text)
{
file_put_contents('/opt/gdsserver/logs/wechat_log.txt', $text . "\r\n\r\n", FILE_APPEND);
}
$message = array("touser" => "@all", "safe" => "0", "agentid" => "3", "msgtype" => "text", "text" => array("content" => "這裏是GDS-PE微信號,正在測試中, <a href=\"http://www.gds-services.com\">GDS官網</a>"));
$options = array('token' => 'N6cq3R', 'encodingaeskey' => 'nil3OzTxXoPHx4mvx0GLbyECkPYrfyiB9ca4Iz61ny3', 'appid' => 'wx926454a4965d2b7c', 'appsecret' => 'PsPkG1V74sWm6V2mNN3F2NOHKQT696g1wrmJZhB7WT-8xcLmt-3rez3FfuH3SzCf', 'agentid' => '3', 'debug' => true, 'logcallback' => '_log');
$weObj = new Wechat($options);
$result = $weObj->sendMessage($message, $agentid = '3');
echo var_export($result, true);
示例2: sendMessage
public function sendMessage()
{
\Wechat::sendMessage('您好', 'oUS_vt5i0R1ODvljFbFfKfPr8BuY');
}