/** * 生成URL * @param string $c 控制器名 * @param string $m 方法名 * @param array $param 其他参数 * @return string */ function printUrl($c, $m, $param = array()) { $c || ($c = $_GET['c']); $m || ($m = $_GET['m']); $urlParam = array('c' => $c, 'm' => $m); $urlParam = array_merge($urlParam, $param); return 'index.php?' . httpBuildQuery($urlParam); }
/** * 发送数据 */ function sendData($dataType = 'sum') { $accessToken = $this->getAccessToken(); $urlParams = array('mainCmd' => $this->mainCmdList[$dataType], 'accessToken' => $accessToken); $url = $this->apiUrl . $this->apiExtList[$dataType] . '?' . httpBuildQuery($urlParams); $data = array('params' => $this->data); $returnData = $this->httpGet($url, jsonEncode($data), array('Content-Type: application/json')); $jsonData = jsonDecode($returnData); //var_dump($jsonData); //exit(); //提交成功 if (isset($jsonData['authcHead']) && $jsonData['authcHead']['retnCode'] == 0) { return true; } else { return false; } }