亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 語言 > PHP > 正文

php微信高級接口群發 多客服

2024-05-04 23:47:11
字體:
來源:轉載
供稿:網友

本文實例為大家分享了php微信高級接口群發、多客服源碼,供大家參考,具體內容如下

/** * 微信接口調用 * 依賴 * 全局變量 * global $uid 公眾號用戶id, $wid 公眾號id, $wechatid 粉絲唯一id; * 參數 * $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; * $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); * 緩存類 自定義 * Cache:set * Cache:get * 具體業務修改 * 1.上傳圖文信息至微信素材庫 * function uploadArticlesToWeiXinServer() * 2.關鍵字匹配圖文回復 * function getArticleData() *  * usage: *  $options = array( *  'token'=>'tokenaccesskey', //填寫你設定的key *  'appid'=>'wxdk1234567890', //填寫高級調用功能的app id *  'appsecret'=>'xxxxxxxxxxxxxxxxxxx', //填寫高級調用功能的密鑰 *  ); */class WeiXinTool {  private $appid;  private $appsecret;  private $access_token;  private $mediaType = array('image' => array("jpg"), 'voice' => array('amr', 'MP3'), 'video' => array('mp4'), 'thumb' => array("jpg"));  private $mediaMaxSize = array('image' => 131072, 'voice' => 262144, 'video' => 1048576, 'thumb' => 65536);  private $tem_file_path = "";//  授權地址  const AUTH_URL = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s';//  素材上傳  const UPLOAD_MEDIA_URL = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=%s&type=%s";  const GET_MEDIA_URL = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=%s&media_id=%s";  const UPLOAD_NEWS_URL = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=%s";  public function __construct($options) {    $this->appid = isset($options['appid']) ? $options['appid'] : '';    $this->appsecret = isset($options['appsecret']) ? $options['appsecret'] : '';    //需修改    //上傳圖片臨時文件目錄自定義    $this->tem_file_path = YYUC_FRAME_PATH . YYUC_PUB . '/' . Session::get('upath');  }  /**   * 需修改   * 具體業務需求,圖文信息上傳至素材庫   * 微站文章上傳至微信素材   * @param type $wid    * @param type $aid   * @return int   */  public function uploadArticlesToWeiXinServer($wid, $aid) {    //具體圖文組裝過程,需修改    $m = new Model('website_article');    $m_pubs = new Model('pubs');    $m_pubs->find(array("id" => $wid));    $m->find(array("wid" => $wid, 'id' => $aid));    $res = array();    if ($m->has_id() && $m_pubs->has_id()) {      $res[] = $m->get_model_array();//      var_dump($res);      $m->votetouser = json_decode($m->votetouser, TRUE);      $articles = $m->votetouser[0];      $m_article = new Model('website_article');      $ress = $m_article->where(array('wid' => $wid, 'id' => $articles))->list_all_array();      $res = array_merge($res, $ress);    } else {      $errarr = array();      $errarr['errcode'] = 44003;      $errarr['errmsg'] = self::$errorno[$errarr['errcode']];      return $errarr;    }    $items = array();    foreach ($res as $k => $v) {      $mediaid = $this->uploadMedia($v['picurl']);      if ($mediaid['media_id']) {        $thumb_media_id = $mediaid['media_id'];      } else {        return $mediaid;      }      $item = array(        "thumb_media_id" => $thumb_media_id,        "author" => $m_pubs->pubun,        "title" => $v['title'],        "content_source_url" => WeiXinTool::complateUrl(WeiSite::parseArticleLinkData($v)),        "content" => $v['reply_content'], //內容 富文本        "digest" => $v['description']//描述      );      $items[] = $item;    }    //以上具體圖文組裝過程,需修改    $postData['articles'] = $items;    $error = $this->uploadNews($postData);    return $error;  }  /**   * 需修改   * 微站文章關鍵字匹配數據解析   */  public static function getArticleData($keyword) {    global $wid;    $m = new Model('website_article');    $m->find(array('wid' => $wid, 'keyword@~' => " " . $keyword . " "));    $res = array();    if ($m->has_id()) {      $res[] = array("tit" => $m->title, "pic" => $m->picurl, "dec" => $m->description, "url" => WeiSite::parseArticleLinkData($m->get_model_array()));      $m->votetouser = json_decode($m->votetouser, TRUE);      $articles = $m->votetouser[0];      if (!empty($articles)) {        foreach ($articles as $v) {          $m_article = new Model('website_article');          $m_article->find(array('wid' => $wid, 'id' => $v));          $res[] = array("tit" => $m_article->title, "pic" => $m_article->picurl, "dec" => $m_article->description, "url" => WeiSite::parseArticleLinkData($m_article->get_model_array()));        }      }      return $res;    }  }  /**   * 獲取accesstoken   * @param type $flag 強制刷新accesstoken 開關   * @return type   */  public function getAccessToken($flag = FALSE) {    $url = sprintf(self::AUTH_URL, $this->appid, $this->appsecret);    $result = Cache::get(md5($url));    if ($flag || empty($result)) {      $result = $this->http_get($url);      $result = json_decode($result, TRUE);      if ($result['errcode']) {        return $result['errcode'];      }      Cache::set(md5($url), $result, 1);    }    $this->access_token = $result['access_token'];    return true;  }  /**   * 上傳媒體   * @param type $file 媒體文件 $url或者物理路徑地址   * @param type $type 類型    * @return int   * return    array (size=3)   'type' => string 'image' (length=5)   'media_id' => string '-0Lr3rX9mDYBB7i5bDydvwFHHm3zW2Uxt0OoDFBPmGRfYiwckiALqHH_DlP9jCm_' (length=64)   'created_at' => int 1400477181   */  public function uploadMedia($file, $type = "image") {    $file = self::complateUrl($file);    $urlarr = parse_url($file);    $filetype = explode(".", $urlarr['path']);    $filetype = strtolower($filetype[count($filetype) - 1]);    $resizeSize = 100; //圖片處理后另存質量    if (!key_exists($type, $this->mediaType) || !in_array($filetype, $this->mediaType[$type])) {//      return 40005; //格式錯誤      $errarr = array();      $errarr['errcode'] = 40005;      $errarr['errmsg'] = self::$errorno[$errarr['errcode']];      return $errarr;    }    $temp_file = $this->tem_file_path . 'uploadMedia.' . $filetype;    $temp_file_resize = $this->tem_file_path . 'uploadMediaResize.' . $filetype;    file_put_contents($temp_file, self::http_get($file));    $handle = fopen($temp_file, "r");    $fstat = fstat($handle);    if ($fstat['size'] > $this->mediaMaxSize[$type]) {      $resizeSize = intval($this->mediaMaxSize[$type] / $fstat['size'] * 100);      ImageTool::resizeImage($temp_file_resize, $temp_file, 400, 400, $resizeSize); //圖片太大再處理壓縮      $temp_file = $temp_file_resize;//      return 40006; //大小錯誤    }    $filePath = realpath($temp_file);    $uploadUrl = sprintf(self::UPLOAD_MEDIA_URL, $this->access_token, $type);    $postData = array("r" => time(), 'media' => "@{$filePath}");    $result = self::http_post($uploadUrl, $postData);    $result = json_decode($result, TRUE);    return $result;  }  /**   * 群發圖文信息   * @param type $touser 粉絲數組/粉絲組id   * @param type $media_id   * @return type   */  public function sendArticles($touser, $media_id) {    $errarr = array();    $postData = array();    $postData['mpnews'] = array("media_id" => $media_id);    $postData['msgtype'] = "mpnews";    if (is_array($touser)) {      //用戶列表群發      $postData['touser'] = $touser;      $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=%s';    } else {      $group = intval($touser);      $groups = $this->getGroups(true);      if (key_exists($group, $groups['list'])) {        $postData['filter'] = array("group_id" => $group);      } else {        $errarr['errcode'] = 40050; //無效分組id        $errarr['errmsg'] = self::$errorno[$errarr['errcode']];        return $errarr;      }      $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=%s';    }    $url = sprintf($url, $this->access_token);    $result = self::http_post($url, self::json_encode($postData));    $result = json_decode($result, TRUE);    return $result;  }  /**   * 刪除群發信息   * @param type $msgid   * @return type   */  public function delSend($msgid) {    $url = 'https://api.weixin.qq.com/cgi-bin/message/mass/delete?access_token=%s';    $url = sprintf($url, $this->access_token);    $postData = array('msgid' => $msgid, 'r' => time());    $result = self::http_post($url, self::json_encode($postData));    $result = json_decode($result, TRUE);    return $result;  }  /**   * 群發圖文素材上傳   $postData = array('articles' => array($item, $item,...));   $item = array(   "thumb_media_id" => "WMQubqCECMQwAjqh8CI500LfhyoG0vmTTlKKJM5oP-of0uLML1_2s26j8XeIorDL",   "author" => "xxx",   "title" => "Happy Day",   "content_source_url" => "www.qq.com",   "content" => "content",   "digest" => "digest"   );   * return    array (size=3)   'type' => string 'news' (length=4)   'media_id' => string 'OuXqv2dgZzxAmK4z-tvStgr6InG18oIllWkD6Tj1qJZVRg-2f64FDU2D3J7dptHs' (length=64)   'created_at' => int 1400477183   */  public function uploadNews($postData) {    $uploadUrl = sprintf(self::UPLOAD_NEWS_URL, $this->access_token);    $result = self::http_post($uploadUrl, self::json_encode($postData));    $result = json_decode($result, TRUE);    return $result;  }  /**   * 獲取粉絲列表   * @param type $nextOpenId   * @return type   */  public function getAllConnects($nextOpenId = "") {    $url = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=%s&next_openid=%s';    $url = sprintf($url, $this->access_token, $nextOpenId);    $result = self::http_get($url);    $result = json_decode($result, TRUE);    $count = count($result['data']['openid']);    $list = $result['data']['openid'];    if ($result['data']['openid'][$count - 1] == $result['next_openid']) {      return $result['data']['openid'];    } else {      $templist = $this->getAllConnects($result['next_openid']);      $list = array_merge($list, $templist);      return $list;    }  }  /**   * 根據粉絲唯一id獲取微信信息   * @param type $openid   * @return type   */  public function getFansInfo($openid) {    $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s&lang=zh_CN';    $url = sprintf($url, $this->access_token, $openid);    $result = self::http_get($url);    $result = json_decode($result, TRUE);    return $result;  }  /**   * 更新粉絲組信息   * @param type $openid   * @param type $groupid   * @return type   */  public function updateFansGroups($openid, $groupid) {    $url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=%s';    $url = sprintf($url, $this->access_token);    $postData = array("to_groupid" => $groupid, 'openid' => $openid);    $result = self::http_post($url, self::json_encode($postData));    $result = json_decode($result, TRUE);    $this->getGroups(true);    return $result;  }  /**   * 獲取粉絲組信息   * @param type $openid   * @return type   */  public function getFansGroupInfo($openid) {    $url = 'https://api.weixin.qq.com/cgi-bin/groups/getid?access_token=%s';    $url = sprintf($url, $this->access_token);    $postData = array("r" => time(), 'openid' => $openid);    $result = self::http_post($url, self::json_encode($postData));    $result = json_decode($result, TRUE);    return $result['groupid'];  }  /**   * 獲取唯一key   * @param type $key   * @return type   */  public function getKey($key) {    return md5($this->appid . $this->appsecret . $key);  }  /**   * 獲取媒體圖片到本地   * @param type $mediaid   * @return string   */  public function getMedia($mediaid) {    $url = sprintf(self::GET_MEDIA_URL, $this->access_token, $mediaid);    $result = self::http_get($url);    $temp_file = $this->tem_file_path . 'getMedia.jpg';    file_put_contents($temp_file, $result);    return $temp_file;  }  /**   * 用戶組   * @param type $flag 強制刷新用戶組   * @return type   */  public function getGroups($flag = false) {    $key = $this->appid . 'gasdfev' . $this->appsecret;    $result = Cache::get($key);    if (empty($result) || $flag) {      $url = 'https://api.weixin.qq.com/cgi-bin/groups/get?access_token=%s';      $url = sprintf($url, $this->access_token);      $result = self::http_get($url);      $result = json_decode($result, TRUE);      $temg = array();      $temlist = array();      foreach ($result['groups'] as $k => $v) {        $temg[$v['id']] = $v;        $temlist[$v['id']] = $v['name'];      }      $result['map'] = $temg;      $result['list'] = $temlist;      Cache::set($key, $result);    }    return $result;  }  /**   * 新增用戶組   * @param type $name   * @return type   */  public function createGroup($name) {    $url = 'https://api.weixin.qq.com/cgi-bin/groups/create?access_token=%s';    $url = sprintf($url, $this->access_token);    $result = self::http_post($url, self::json_encode(array('group' => array('name' => $name))));    $result = json_decode($result, TRUE);    return $result;  }  /**   * 修改用戶組   * @param type $id   * @param type $name   * @return type   */  public function modifyGroup($id, $name) {    $url = 'https://api.weixin.qq.com/cgi-bin/groups/update?access_token=%s';    $url = sprintf($url, $this->access_token);    $result = self::http_post($url, self::json_encode(array('group' => array('id' => $id, 'name' => $name))));    $result = json_decode($result, TRUE);    return $result;  }  /**   * 多客服接入   * @global type $wid   * @param type $postObj   */  public static function responseService($postObj) {    global $wid;    $fromUsername = $postObj->FromUserName;    $toUsername = $postObj->ToUserName;    $textTpl = "<xml><ToUserName><![CDATA[%s]]></ToUserName><FromUserName><![CDATA[%s]]></FromUserName><CreateTime>%s</CreateTime><MsgType><![CDATA[transfer_customer_service]]></MsgType></xml>";    $resstr = sprintf($textTpl, $fromUsername, $toUsername, time());    echo $resstr;  }  /**   * 微信回復多圖文   * @global type $wid   * @param type $res   * array(array(),array()   * );   * @param type $rid   * @param type $postObj   */  public static function response_morearts($res, $postObj) {    global $wid;    $fromUsername = $postObj->FromUserName;    $toUsername = $postObj->ToUserName;    $textTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <ArticleCount>%s</ArticleCount> <Articles> ITEM </Articles> </xml>";    $resstr = sprintf($textTpl, $fromUsername, $toUsername, time(), "news", count($res));    $item = '';    $subitem = "<item> <Title><![CDATA[%s]]></Title> <Description><![CDATA[%s]]></Description> <PicUrl><![CDATA[%s]]></PicUrl> <Url><![CDATA[%s]]></Url> </item>";    foreach ($res as $r) {      $r['url'] = self::parseUrl($r['url']);      $item .= sprintf($subitem, $r['tit'], $r['des'], self::complateUrl($r['pic']), self::replaceToWXUrl(self::complateUrl($r['url']), $postObj));    }    $resstr = str_replace('ITEM', $item, $resstr);    echo $resstr;  }  /**   * url解析   * @param type $url   * @return string   */  public static function complateUrl($url) {    if (false === stristr($url, "http://")) {//查找http:// 如果不存在      if (0 === strpos($url, '/')) {//查找首字母 如果存在        $url = substr($url, 1); //去除/      }      $url = "http://" . $_SERVER['HTTP_HOST'] . '/' . $url; //拼接完整路徑    }    return $url;  }  /**   * 微信url固定參數替換   * @param type $url   * @param type $postObj   * @return type   */  public static function replaceToWXUrl($url, $postObj) {    global $wechatid;    return str_ireplace('fromUsername', $wechatid, $url);  }  /**   * 完成以下行為   * parseUrlParam   * setUrlPublicParam   * buildUrlParam   * @param type $url   * @param type $other 附加參數 基礎參數wid wxid wechatid   */  public static function parseUrl($url, $other = array()) {    $url = self::parseUrlParam($url);    $url = self::setUrlPublicParam($url);    if (is_array($other) && !empty($other)) {      $url['param'] = array_merge($url['param'], $other);    }    $url = self::buildUrlParam($url);    return $url;  }  /**   * 分析url   * @param type $url   * @return type   */  public static function parseUrlParam($url) {    $temp = explode("?", $url);    $url0 = $temp[0];    $url1 = $temp[1];    $p = explode("&", $url1);    $param = array();    foreach ($p as $v) {      $tempp = explode("=", $v);      $param[$tempp[0]] = $tempp[1];    }    return array("url" => $url0, "param" => $param);  }  /**   * 組裝url   * @param type $arr   * @return type   */  public static function buildUrlParam($arr) {    $url = $arr['url'];    $param = $arr['param'];    $param_arr = array();    foreach ($param as $k => $v) {      if ($k == "") continue;      $param_arr[] = $k . "=" . $v;    }    return $url . "?" . implode("&", $param_arr) . "#mp.weixin.qq.com";  }  /**   * 設置微信保留參數信息   * @global type $uid   * @global type $wid   * @global type $wechatid   * @param type $url   * @return type   */  public static function setUrlPublicParam($url) {    global $uid, $wid, $wechatid;    $url['param']['wid'] = $wid;    $url['param']['wxid'] = $wechatid;    $url['param']['wechatid'] = $wechatid;    return $url;  }  public static $errorno = array(    '-1' => '系統繁忙',    '0' => '請求成功',    '40001' => '獲取access_token時AppSecret錯誤,或者access_token無效',    '40002' => '不合法的憑證類型',    '40003' => '不合法的OpenID',    '40004' => '不合法的媒體文件類型',    '40005' => '不合法的文件類型',    '40006' => '不合法的文件大小',    '40007' => '不合法的媒體文件id',    '40008' => '不合法的消息類型',    '40009' => '不合法的圖片文件大小',    '40010' => '不合法的語音文件大小',    '40011' => '不合法的視頻文件大小',    '40012' => '不合法的縮略圖文件大小',    '40013' => '不合法的APPID',    '40014' => '不合法的access_token',    '40015' => '不合法的菜單類型',    '40016' => '不合法的按鈕個數',    '40017' => '不合法的按鈕個數',    '40018' => '不合法的按鈕名字長度',    '40019' => '不合法的按鈕KEY長度',    '40020' => '不合法的按鈕URL長度',    '40021' => '不合法的菜單版本號',    '40022' => '不合法的子菜單級數',    '40023' => '不合法的子菜單按鈕個數',    '40024' => '不合法的子菜單按鈕類型',    '40025' => '不合法的子菜單按鈕名字長度',    '40026' => '不合法的子菜單按鈕KEY長度',    '40027' => '不合法的子菜單按鈕URL長度',    '40028' => '不合法的自定義菜單使用用戶',    '40029' => '不合法的oauth_code',    '40030' => '不合法的refresh_token',    '40031' => '不合法的openid列表',    '40032' => '不合法的openid列表長度',    '40033' => '不合法的請求字符,不能包含/uxxxx格式的字符',    '40035' => '不合法的參數',    '40038' => '不合法的請求格式',    '40039' => '不合法的URL長度',    '40050' => '不合法的分組id',    '40051' => '分組名字不合法',    '40059' => '不合法的消息id',    '41001' => '缺少access_token參數',    '41002' => '缺少appid參數',    '41003' => '缺少refresh_token參數',    '41004' => '缺少secret參數',    '41005' => '缺少多媒體文件數據',    '41006' => '缺少media_id參數',    '41007' => '缺少子菜單數據',    '41008' => '缺少oauth code',    '41009' => '缺少openid',    '42001' => 'access_token超時',    '42002' => 'refresh_token超時',    '42003' => 'oauth_code超時',    '43001' => '需要GET請求',    '43002' => '需要POST請求',    '43003' => '需要HTTPS請求',    '43004' => '需要接收者關注',    '43005' => '需要好友關系',    '44001' => '多媒體文件為空',    '44002' => 'POST的數據包為空',    '44003' => '圖文消息內容為空',    '44004' => '文本消息內容為空',    '45001' => '多媒體文件大小超過限制',    '45002' => '消息內容超過限制',    '45003' => '標題字段超過限制',    '45004' => '描述字段超過限制',    '45005' => '鏈接字段超過限制',    '45006' => '圖片鏈接字段超過限制',    '45007' => '語音播放時間超過限制',    '45008' => '圖文消息超過限制',    '45009' => '接口調用超過限制',    '45010' => '創建菜單個數超過限制',    '45015' => '回復時間超過限制',    '45016' => '系統分組,不允許修改',    '45017' => '分組名字過長',    '45018' => '分組數量超過上限',    '46001' => '不存在媒體數據',    '46002' => '不存在的菜單版本',    '46003' => '不存在的菜單數據',    '46004' => '不存在的用戶',    '47001' => '解析JSON/XML內容錯誤',    '48001' => 'api功能未授權',    '50001' => '用戶未授權該api'  );  /**   * GET 請求   * @param string $url   */  public static function http_get($url) {    if (!function_exists('curl_init')) {      die('curl 未開啟');    };    $oCurl = curl_init();    if (stripos($url, "https://") !== FALSE) {      curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);      curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);    }    curl_setopt($oCurl, CURLOPT_URL, $url);    curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);    $sContent = curl_exec($oCurl);    $aStatus = curl_getinfo($oCurl);    curl_close($oCurl);    if (intval($aStatus["http_code"]) == 200) {      return $sContent;    } else {      return false;    }  }  /**   * POST 請求   * @param string $url   * @param array $param   * @return string content   */  public static function http_post($url, $param, $httpBuildQuery = false) {    if (!function_exists('curl_init')) {      die('curl 未開啟');    };    $oCurl = curl_init();    if (stripos($url, "https://") !== FALSE) {      curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);      curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);    }    curl_setopt($oCurl, CURLOPT_URL, $url);    curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);//    curl_setopt($oCurl, CURLOPT_HTTPHEADER, $header);//設置HTTP頭    curl_setopt($oCurl, CURLOPT_POST, 1);    if ($httpBuildQuery) {      $param = http_build_query($param);    }    curl_setopt($oCurl, CURLOPT_POSTFIELDS, $param);    $sContent = curl_exec($oCurl);    $aStatus = curl_getinfo($oCurl);    curl_close($oCurl);    if (intval($aStatus["http_code"]) == 200) {      return $sContent;    } else {      return false;    }  }  /**   * 微信api不支持中文轉義的json結構   * @param array $arr   */  static function json_encode($arr) {    $parts = array();    $is_list = false;    //Find out if the given array is a numerical array    $keys = array_keys($arr);    $max_length = count($arr) - 1;    if (($keys [0] === 0) && ($keys [$max_length] === $max_length )) { //See if the first key is 0 and last key is length - 1      $is_list = true;      for ($i = 0; $i < count($keys); $i ++) { //See if each key correspondes to its position        if ($i != $keys [$i]) { //A key fails at position check.          $is_list = false; //It is an associative array.          break;        }      }    }    foreach ($arr as $key => $value) {      if (is_array($value)) { //Custom handling for arrays        if ($is_list) $parts [] = self::json_encode($value); /* :RECURSION: */        else $parts [] = '"' . $key . '":' . self::json_encode($value); /* :RECURSION: */      } else {        $str = '';        if (!$is_list) $str = '"' . $key . '":';        //Custom handling for multiple data types        if (is_numeric($value) && $value < 2000000000) $str .= $value; //Numbers        elseif ($value === false) $str .= 'false'; //The booleans        elseif ($value === true) $str .= 'true';        else $str .= '"' . addslashes($value) . '"';//All other things// :TODO: Is there any more datatype we should be in the lookout for? (Object?)        $parts [] = $str;      }    }    $json = implode(',', $parts);    if ($is_list) return '[' . $json . ']'; //Return numerical JSON    return '{' . $json . '}'; //Return associative JSON  }}

以上就是本文的全部內容,希望對大家學習php程序設計有所幫助。


注:相關教程知識閱讀請移步到PHP教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲а∨天堂久久精品喷水| 国产精品video| 日韩成人中文字幕在线观看| 亚洲最大福利视频网站| 97婷婷大伊香蕉精品视频| 久久97久久97精品免视看| 国产精品白嫩初高中害羞小美女| 欧美激情亚洲激情| 92版电视剧仙鹤神针在线观看| 国产精品海角社区在线观看| 影音先锋欧美精品| 国产免费一区二区三区在线观看| 久久色在线播放| 欧美成人国产va精品日本一级| 亚洲精品中文字幕av| 国产成人av网| 亚洲欧美国产日韩天堂区| 亚洲毛茸茸少妇高潮呻吟| 国产第一区电影| 国产精品黄色影片导航在线观看| 国产精品日韩av| 热re91久久精品国99热蜜臀| 日韩精品视频在线观看免费| 欧美劲爆第一页| 欧美人与物videos| 日韩av手机在线看| 欧美性猛交xxxx乱大交| 欧美日韩免费在线| 国产精品日韩欧美| 色综合久久中文字幕综合网小说| 欧美激情久久久久久| 久久精品视频一| 国产成人精品免费久久久久| 激情懂色av一区av二区av| 亚洲美女视频网| 精品国产网站地址| 亚洲激情久久久| 91成人天堂久久成人| 亚洲欧美日韩一区在线| 欧美国产在线视频| 国产日产欧美精品| 都市激情亚洲色图| 欧美激情视频一区| 国产视频精品免费播放| 国内精品久久久久久影视8| 国产成人avxxxxx在线看| 国产精品电影久久久久电影网| 亚洲第一视频网站| 亚洲国产精品va| 欧美国产日韩一区二区在线观看| 久久久久久91香蕉国产| 欧美高清视频免费观看| 欧美在线一区二区三区四| 久久精品国产成人精品| 夜色77av精品影院| 91精品免费看| 色与欲影视天天看综合网| 最近2019免费中文字幕视频三| 欧美日韩国产91| 日韩有码在线播放| 国产精品高清在线| 久久久噜噜噜久噜久久| 久久精品国产69国产精品亚洲| 国产精品久久久久久久app| 91视频8mav| 日本韩国欧美精品大片卡二| 久久99久国产精品黄毛片入口| 久久久久久久影院| 日韩免费在线电影| 久久夜色精品国产| 亚洲欧洲一区二区三区在线观看| 日韩一区二区三区国产| 欧美日韩在线视频首页| 欧美亚洲另类激情另类| 最近2019年日本中文免费字幕| 97人人模人人爽人人喊中文字| 好吊成人免视频| 国内精品一区二区三区四区| 久久久亚洲天堂| 97久久精品人搡人人玩| 国产成人a亚洲精品| 亚洲欧美国产精品va在线观看| 国产91九色视频| 久久久亚洲精品视频| 久久久久久国产精品三级玉女聊斋| 国产精品日韩在线观看| 国产一区二区三区直播精品电影| 国产精品va在线播放我和闺蜜| 国产精品久久久久久久电影| 亚洲第一网站免费视频| 亚洲性日韩精品一区二区| 亚洲第一福利网站| 精品视频在线播放| 国产日韩欧美视频在线| 久久999免费视频| 91精品视频观看| 中文字幕亚洲精品| 亚洲性视频网址| 亚洲成人国产精品| 国产大片精品免费永久看nba| 亚洲xxxxx电影| 日韩中文字幕免费| 亚洲一区二区黄| xxav国产精品美女主播| 欧美电影免费观看高清完整| 亲爱的老师9免费观看全集电视剧| 91精品国产高清自在线看超| 亚洲美女免费精品视频在线观看| 久久国产精彩视频| 欧美中文字幕在线播放| 久久久亚洲网站| 国产suv精品一区二区三区88区| 欧美性猛交xxxx黑人| 91在线观看欧美日韩| 中文字幕亚洲一区在线观看| 91精品视频在线播放| 国内免费久久久久久久久久久| 亚洲国产精品大全| 久久91超碰青草是什么| 国产成人精品免费久久久久| 亚洲精品91美女久久久久久久| 日韩av一卡二卡| 日韩中文娱乐网| 欧美性猛交xxxx乱大交极品| 国产精品欧美在线| 九九综合九九综合| 久久99青青精品免费观看| 久久精品国产91精品亚洲| 国产精品揄拍一区二区| 久久成人精品电影| 亚洲欧美日本伦理| 亚洲黄色片网站| 欧美黑人性生活视频| 亚洲性69xxxbbb| 操91在线视频| 亚洲男人第一网站| 国产成人在线一区| 亚洲综合av影视| 国产91精品久久久久| 欧美风情在线观看| 国产精品永久免费视频| 久久电影一区二区| 亚洲a一级视频| 国产成人一区二区在线| 国产精品女主播| 青草青草久热精品视频在线网站| 最近2019中文字幕一页二页| 少妇激情综合网| 久久久久一本一区二区青青蜜月| 国产精品pans私拍| 精品丝袜一区二区三区| 69久久夜色精品国产69乱青草| 成人免费大片黄在线播放| 26uuu另类亚洲欧美日本一| 日日狠狠久久偷偷四色综合免费| 亚洲午夜未满十八勿入免费观看全集| 国产精品女主播视频| 81精品国产乱码久久久久久| 青青久久av北条麻妃海外网| 国产精品中文在线| 欧美精品电影在线| 久久99精品视频一区97| 国产精品久久久久一区二区| 午夜精品福利在线观看|