<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                1.根目錄下的ThinkPHP\Library\Com文件夾中的WechatAuth.class.php文件中沒有預覽群發接口的方法,首先打開這個文件,添加這個方法: ~~~ /* *預覽群發接口 */ public function meassageMass($msgtype,$openid,$content){ $data=array( 'touser'=>$openid, $msgtype=>array("content"=>$content), 'msgtype'=>$msgtype ); //echo json_encode($data); //exit; return $this->api("message/mass/preview",$data); } ~~~ ![](https://box.kancloud.cn/913b708a55309c57fce41a2f8dd693a1_909x589.png) 2.根目錄下的/Application/Home/Controller文件夾中的MassController.class.php文件,書寫代碼為: ~~~ <?php namespace Home\Controller; use Think\Controller; use Com\Wechat; use Com\WechatAuth; class MassController extends Controller { private $appid="wx165112bf167af76c"; private $appSecret="c65b22bfcf03fdd98504eac299701b03"; private $WechatAuth="";//初始化WechatAuth類 private $access_token="";//緩存token public function __construct(){ parent::__construct();//可能內部已經有這個構造方法了,因此加上這個 if(!session('token')){ $this->WechatAuth=new WechatAuth($this->appid,$this->appSecret);//初始化WechatAuth類 $WechatAuth=$this->WechatAuth; $token=$WechatAuth->getAccessToken(); session(array('expire'=>$token['expires_in']));//設置過期時間 session('token',$token['access_token']);//緩存token $this->access_token=$token; }else{ $token=session('token'); $this->WechatAuth=new WechatAuth($this->appid,$this->appSecret,$token);//初始化WechatAuth類 $this->access_token=$token;//緩存token } } //預覽群發消息 public function send(){ header('Content-type:text/html;charset=utf-8;'); $WechatAuth=$this->WechatAuth; $msgtype="text"; $openid="orVDLwCI0NcQk0skZPNrfZkaj-aE";//暫時直接從數據庫中復制的openid $content="你好,我在預覽群發消息"; $arr=$WechatAuth->meassageMass($msgtype,$openid,$content); var_dump($arr); } } ~~~ 3.注意點 ![](https://box.kancloud.cn/aec826ccfc5b8afa5176b213167bb133_677x285.png) 4.在微信web開發者工具上測試結果為 ![](https://box.kancloud.cn/aed194890ecfff4f50ca1fc066119cf0_996x382.png) 5.在微信客戶端的公眾號里查看是否群發了消息 ![](https://box.kancloud.cn/66881fc381ce3605fed7803d1bc59f57_360x73.png) 6.本節源碼下載(下載密碼:mjol) [源碼下載](https://pan.baidu.com/s/1KZD1CJUE73jTq4mCFMsY2A)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看