zoukankan      html  css  js  c++  java
  • php数组转换成json格式。

       {
               "touser":"OPENID",
               "template_id":"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY",
               "url":"http://weixin.qq.com/download",            
               "data":{
                       "first": {
                           "value":"恭喜你购买成功!",
                           "color":"#173177"
                       },
                       "keynote1":{
                           "value":"巧克力",
                           "color":"#173177"
                       },
                       "keynote2": {
                           "value":"39.8元",
                           "color":"#173177"
                       },
                       "keynote3": {
                           "value":"2014年9月22日",
                           "color":"#173177"
                       },
                       "remark":{
                           "value":"欢迎再次购买!",
                           "color":"#173177"
                       }
               }
           }
    
    
    
    
    
    public function settemplateMsg(){
        
            $templateID = "oCn07pNLLCgUP9KN4T34sCs69nIqrBgtuCtAdVWaHOg";
            $posttemepleUrl ="https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=".$this->access_token;
    
    
            $postData = array();
            $postData['touser']= "o2Q4wtwk4NlLqy7QwTWG5vc8RVus";
            $postData['template_id']= $templateID;
            $postData['url']= "http://m.ancun.org/wxmsg/index.php/home/attention";
    
            
            $templArr= array();
            $templArr['first'] = array('value'=>'有美女给你发信息啦','color'=>'#173177');
            $templArr['keyword1'] = array('value'=>'明天你有时间吗。我要你出来一下。','color'=>'#173177');
            $templArr['keyword2'] = array('value'=>'存宝系统 ','color'=>'#173177');
            $templArr['keyword3'] = array('value'=>'王您码','color'=>'#173177');
            $templArr['keyword4'] = array('value'=>'2014年9月22日','color'=>'#173177');
            $templArr['remark'] = array('value'=>'欢迎再次使用。','color'=>'#173177');
            
            $postData['data']= $templArr;
            
            $postData = json_encode($postData);
    
            $result =  $this->http_request($posttemepleUrl,$postData);
            return json_decode($result,true);
    
    
        }
  • 相关阅读:
    T-SQL:Varchar和Nvarchar区别(八)
    UI5-文档-4.1-Hello World!
    UI5-文档-4-Walkthrough
    UI5-文档-3-Hello World!
    UI5-文档-2.5-开发混合Web容器
    UI5-文档-2.4-Node.js-Based开发环境
    UI5-文档-2.3-使用SAPUI5工具为Eclipse开发应用程序
    UI5-文档-2.2-使用SAP Web IDE开发应用程序
    UI5-文档-2.1-使用OpenUI5开发应用
    UI5-文档-2-开发环境
  • 原文地址:https://www.cnblogs.com/longhs/p/4923380.html
Copyright © 2011-2022 走看看