當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WebUtils::jsonDecode方法代碼示例

本文整理匯總了PHP中WebUtils::jsonDecode方法的典型用法代碼示例。如果您正苦於以下問題:PHP WebUtils::jsonDecode方法的具體用法?PHP WebUtils::jsonDecode怎麽用?PHP WebUtils::jsonDecode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WebUtils的用法示例。


在下文中一共展示了WebUtils::jsonDecode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run($tid, $act = 'apply')
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $_REQUEST['json'] = "{'payment':1,'payvalue':100, 'realname': '請求參數11', 'qq': '8', 'message': '請求參數'}";
     $json = isset($_REQUEST['json']) ? $_REQUEST['json'] : '';
     $json = rawurldecode($json);
     $data = WebUtils::jsonDecode($json);
     if (!empty($data)) {
         foreach ($data as $key => $value) {
             if (is_string($value)) {
                 $data[$key] = WebUtils::t($value);
             }
         }
         switch ($act) {
             case 'apply':
                 $res = $this->_applyActivityTopic($res, $tid, $uid, $data);
                 break;
             case 'cancel':
                 $res = $this->_cancelActivityTopic($res, $tid, $uid, $data);
                 break;
             default:
                 $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
                 break;
         }
     } else {
         $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:30,代碼來源:TopicActivityAction.php

示例2: _updateUser

 private function _updateUser($res, $gender, $avatar)
 {
     global $_G;
     include_once libfile('function/profile');
     $setarr['gender'] = intval($gender);
     if ($setarr) {
         C::t('common_member_profile')->update($_G['uid'], $setarr);
     }
     manyoulog('user', $uid, 'update');
     $operation = 'gender';
     include_once libfile('function/feed');
     feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile'));
     countprofileprogress();
     // ob_start();
     // $this->getController()->forward('user/uploadavatar', false);
     // $result = ob_get_clean();
     // $picInfo = WebUtils::jsonDecode($result, true);
     // $avatar = $picInfo['pic_path'];
     // $avatar = !empty($_GET['avatar']) ? $_GET['avatar'] : '';
     if (!empty($avatar)) {
         $_GET = array_merge($_GET, array('avatar' => $avatar));
         ob_start();
         $this->getController()->forward('user/saveavatar', false);
         $result = ob_get_clean();
         $result = WebUtils::jsonDecode($result);
         if (WebUtils::checkError($result)) {
             return $this->makeErrorInfo($res, 'user_info_avatar_error');
         }
     }
     return $this->makeErrorInfo($res, lang('message', 'profile_succeed'), array('noError' => 1));
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:31,代碼來源:UpdateUserInfoAction.php

示例3: run

 public function run($attachment)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $attachment ="{'head': {'errCode': 0, 'errInfo': ''}, 'body': {'attachment': {'name': 'test', 'isPost': 1, 'data': 'ss', 'type': 'image', 'module':'forum'}, 'externInfo': {}}}";
     $attachment = rawurldecode($attachment);
     $attachment = WebUtils::jsonDecode($attachment);
     $attachment = isset($attachment['body']['attachment']) ? $attachment['body']['attachment'] : array();
     !isset($attachment['module']) && ($attachment['module'] = 'forum');
     $resAttachment = false;
     if (!empty($attachment)) {
         if ($attachment['isPost'] == 1) {
             if (($data = file_get_contents('php://input')) === false) {
                 $attachment['data'] = $GLOBALS['HTTP_RAW_POST_DATA'];
             } else {
                 $attachment['data'] = $data;
             }
         }
         // $attachment['data'] = WebUtils::httpRequest('http://bbs.appbyme.com/static/image/common/logo.png');// test
         $resAttachment = $this->_saveAttachment($uid, $attachment);
     }
     if ($resAttachment === false) {
         $attachmentTypes = array('audio' => WebUtils::t('語音'), 'image' => WebUtils::t('圖片'));
         $res = WebUtils::makeErrorInfo_oldVersion($res, 'UPLOAD_ATTACHMENT_ERROR', array('{attachment}' => $attachmentTypes[$attachment['type']]));
     } else {
         $res['body']['attachment'] = $resAttachment;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:29,代碼來源:SendAttachmentAction.php

示例4: run

 public function run($share)
 {
     $res = $this->initWebApiArray();
     // $share = "{'body': {'shareInfo': {'shareId':8,'shareType': 'news'}}}";
     $share = rawurldecode($share);
     $shareInfo = WebUtils::jsonDecode($share);
     $res['body']['shareData'] = $this->_getShareData($shareInfo);
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:9,代碼來源:ShareAction.php

示例5: _getForWardInfo

 private function _getForWardInfo($params)
 {
     $_GET = array_merge($_GET, $params);
     ob_start();
     $this->getController()->forward('user/userlist', false);
     $res = ob_get_clean();
     $list = WebUtils::jsonDecode($res);
     return $list['list'];
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:9,代碼來源:AtUserListAction.php

示例6: run

 public function run($json)
 {
     $res = $this->initWebApiArray();
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['page']) && ($json['page'] = 1);
     !isset($json['pageSize']) && ($json['pageSize'] = 10);
     $res = $this->_getResult($res, $json);
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:10,代碼來源:PMSessionListAction.php

示例7: run

 public function run($pmlist)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // $pmlist ='{"body": {"pmInfos": [{"fromUid": 4, "startTime": "0", "stopTime": "0", "cacheCount": 0, "pmLimit": 10, }], "externInfo": {"onlyFromUid":0} } }';
     $pmlist = rawurldecode($pmlist);
     $pmInfos = WebUtils::jsonDecode($pmlist);
     $res['body']['userInfo'] = $this->_getUserInfo($uid);
     $res['body']['pmList'] = $this->_getPMList($uid, $pmInfos);
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:11,代碼來源:PMListAction.php

示例8: run

 public function run($json)
 {
     $res = $this->initWebApiArray();
     // $json = '{"aid": 10, "page": 1}';
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['aid']) && ($json['aid'] = 0);
     !isset($json['page']) && ($json['page'] = 1);
     $res = $this->_getResult($res, (int) $json['aid'], (int) $json['page']);
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:11,代碼來源:NewsViewAction.php

示例9: run

 public function run($json)
 {
     $res = $this->initWebApiArray();
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'send');
     !isset($json['toUid']) && ($json['toUid'] = 0);
     !isset($json['plid']) && ($json['plid'] = 0);
     !isset($json['pmid']) && ($json['pmid'] = 0);
     $res = $this->_pmAdmin($res, $json);
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:12,代碼來源:PMAdminAction.php

示例10: run

 public function run($setting)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // test
     // $setting ='{"head": {"errCode": 0, "errInfo": ""}, "body": {"settingInfo": {"hidden": 0}, "externInfo": {}}}';
     $settings = rawurldecode($setting);
     $settings = WebUtils::jsonDecode($settings);
     $settings = !empty($settings) ? $settings['body']['settingInfo'] : array();
     // insert or update new settings
     AppbymeUserSetting::saveNewSettings($uid, $settings);
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:13,代碼來源:SettingAction.php

示例11: _doNewApp

 private function _doNewApp($res, $appKey, $test)
 {
     // $url = 'http://192.168.1.211:9797/mobcentACA/app/wAMkQjefj3HPHsrfCk/profile';
     $url = 'http://www.appbyme.com/mobcentACA/app/' . $appKey . '/profile';
     $temRes = WebUtils::httpRequest($url, 30);
     $temRes = WebUtils::jsonDecode($temRes);
     $appInfo = array('appName' => WebUtils::t($temRes['appName']), 'appAuthor' => WebUtils::t($temRes['appAuthor']), 'appDescribe' => WebUtils::t($temRes['appDescribtion']), 'appVersion' => WebUtils::t($temRes['appVersion']), 'appIcon' => $temRes['appIcon'], 'appImage' => $temRes['appCover'], 'appContentId' => $temRes['contentId'], 'appDownloadUrl' => array('android' => $temRes['apkUrl'], 'apple' => $temRes['ipaUrl'], 'appleMobile' => $temRes['plistUrl']), 'appQRCode' => array('android' => $temRes['qrcode'], 'apple' => $temRes['qrcode']));
     if ($test == 0) {
         AppbymeConfig::saveDownloadOptions($appInfo);
         AppbymeConfig::saveForumkey($temRes['forumKey']);
     }
     return $res;
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:13,代碼來源:ServerNotifyAction.php

示例12: _getWeatherConfig

 private function _getWeatherConfig()
 {
     $weather = array('allowUsage' => 1, 'allowCityQuery' => 1);
     $forumKey = isset($_GET['forumKey']) ? $_GET['forumKey'] : '';
     $platType = isset($_GET['platType']) ? $_GET['platType'] : APP_TYPE_ANDROID;
     $url = 'http://sdk.mobcent.com/baikesdk/phpapi/settings';
     // $url = 'http://192.168.1.213/forum/phpapi/settings';
     $url .= sprintf('?forumKey=%s&platType=%s&gzip=false', $forumKey, $platType);
     $res = WebUtils::httpRequest($url, 10);
     $res = WebUtils::jsonDecode($res);
     isset($res['data']['weather']['show_weather']) && ($weather['allowUsage'] = (int) $res['data']['weather']['show_weather']);
     isset($res['data']['weather']['city_query_setting']) && ($weather['allowCityQuery'] = (int) $res['data']['weather']['city_query_setting']);
     return $weather;
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:14,代碼來源:GetSettingAction.php

示例13: run

 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'id': 1, 'idType': 'aid', 'page': 1, 'pageSize': 10, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     $res = $this->_checkComment($res, $json);
     if (!WebUtils::checkError($res)) {
         $comments = $this->getCommentList($json);
         $res['body']['list'] = $comments['list'];
         $res = array_merge($res, WebUtils::getWebApiArrayWithPage($res, $json['page'], $json['pageSize'], $comments['count']));
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:caidongyun,項目名稱:CS,代碼行數:14,代碼來源:CommentListAction.php

示例14: run

 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'action': 'reply', 'idType': 'aid', 'id': 1, 'content': [{'type': 0, 'infor': '嗬嗬\r\nhaha%25E5%2591%25B5%25E5%2591%25B5%25E2%2580%259C%25E2%2580%259D%2522%2522',}], 'quoteCommentId': 12, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'reply');
     !isset($json['idType']) && ($json['idType'] = 'aid');
     switch ($json['action']) {
         case 'reply':
             $res = $this->_commentReply($res, $json);
             break;
         default:
             $res = WebUtils::makeErrorInfo_oldVersion($res, 'mobcent_error_params');
             break;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:18,代碼來源:CommentAdminAction.php

示例15: runWithCache

 protected function runWithCache($key, $params = array())
 {
     $page = $params['page'];
     $fid = $params['fid'];
     $res = array();
     $cache = $this->getCacheInfo();
     if (!$cache['enable'] || ($res = Yii::app()->cache->get($key)) === false) {
         // var_dump('no cache');
         if ($params['sort'] == 'photo') {
             $_GET = array_merge($_GET, $params);
             ob_start();
             $this->getController()->forward('forum/photogallery', false);
             $res = WebUtils::jsonDecode(ob_get_clean());
             $res = WebUtils::outputWebApi($res, 'utf-8', false);
         } else {
             $res = WebUtils::outputWebApi($this->getResult($params), '', false);
         }
         if ($page == 1) {
             if ($fid > 0 && $sort != 'top') {
                 $sql = '
                     SELECT lastpost
                     FROM %t
                     WHERE fid=%d
                     ';
                 $params = array('forum_forum', $fid);
             } else {
                 $sql = '
                     SELECT MAX(dateline)
                     FROM %t
                     ';
                 $params = array('forum_post');
             }
             $dep = new DiscuzDbCacheDependency($sql, $params);
             if ($cache['enable']) {
                 Yii::app()->cache->set($key, $res, $cache['expire'], $dep);
             }
         }
     }
     echo $res;
 }
開發者ID:frogoscar,項目名稱:mobcent-discuz,代碼行數:40,代碼來源:TopicListAction.php


注:本文中的WebUtils::jsonDecode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。