/** * qqLogin */ public function qqLogin() { $state = md5(rand(5, 10)); Yii::app()->session->add('qq_state', $state); $qqService = new qqConnectAuthV2(QQ_APPID, QQ_APPKEY); $this->qq_code_url = $qqService->getAuthorizeURL(QQ_CALLBACK_URL, 'code', $state); Yii::app()->session->add('back_url', $this->back_url . '?state=' . $state); }
/** * @ignore */ public static function build_http_query_multi($params) { if (!$params) { return ''; } uksort($params, 'strcmp'); $pairs = array(); self::$boundary = $boundary = uniqid('------------------'); $MPboundary = '--' . $boundary; $endMPboundary = $MPboundary . '--'; $multipartbody = ''; foreach ($params as $parameter => $value) { if (in_array($parameter, array('pic', 'image')) && $value[0] == '@') { $url = ltrim($value, '@'); $content = file_get_contents($url); $array = explode('?', basename($url)); $filename = $array[0]; $multipartbody .= $MPboundary . "\r\n"; $multipartbody .= 'Content-Disposition: form-data; name="' . $parameter . '"; filename="' . $filename . '"' . "\r\n"; $multipartbody .= "Content-Type: image/unknown\r\n\r\n"; $multipartbody .= $content . "\r\n"; } else { $multipartbody .= $MPboundary . "\r\n"; $multipartbody .= 'content-disposition: form-data; name="' . $parameter . "\"\r\n\r\n"; $multipartbody .= $value . "\r\n"; } } $multipartbody .= $endMPboundary; return $multipartbody; }