国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? EaglePHP ?????? ???? ????? ??? ??? PHP QQ Oauth 2.0 SDK ???

EaglePHP ?????? ???? ????? ??? ??? PHP QQ Oauth 2.0 SDK ???

Jul 25, 2016 am 08:50 AM

? ??? ??? ??? ? ????

QQ ??? o?? ???

??? ?? ????

?? ??

?? ?? ????

?? ?? ???

?? ???

?? ???

?? ??

??? ???

???? ??? ????

Weibo? ?? ??? ??

Weibo ??? ?? ????

??? ??? ?? ????

??? ?? ?? ????

Tencent ???? ? ?? ???

獲取財(cái)付? ????? ???? 收貨地址
  1. /**
  2. *
  3. * QQ ?? ??? API
  4. * @author maojianlw@139.com
  5. * @since 2013-06-20
  6. * @link http://www.eaglephp.com
  7. *
  8. */
  9. class QQ
  10. {
  11. ??? $ appid = null;
  12. private $appkey = null;
  13. private $callbcak = null;
  14. private $APIMap = array();
  15. private $ keyArr = array();
  16. const VERSION = '2.0';
  17. const AUTH_CODE_URL = 'https://graph.qq.com/oauth2.0/authorize';
  18. const ACCESS_TOKEN_URL = 'https://graph.qq.com/oauth2.0/token';
  19. const OPENID_URL = 'https://graph.qq.com/oauth2.0/me';
  20. const SCOPE = 'get_user_info,add_share,list_album,add_album,upload_pic,add_topic,add_one_blog,add_weibo,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idolist,add_idol,del_idol,get_ten pay_addr' ;
  21. ?? ?? __construct($appid, $appkey, $callbcak)
  22. {
  23. $this->appid = $appid;
  24. $this-> ;appkey = $appkey;
  25. $this->callbcak = $callbcak;
  26. }
  27. /**
  28. * ???
  29. */
  30. ?? ?? ???()
  31. {
  32. $state = md5(uniqid(rand(), true)); // 生成唯一隨機(jī)串防CSRF攻擊
  33. Session::set('state', $state);
  34. $keysArr = array(
  35. 'response_type' => 'code',
  36. ' client_id' => $this->appid,
  37. 'redirect_uri' => $this->callbcak,
  38. 'scope' => self::SCOPE,
  39. 'state' => ; $state
  40. );
  41. header('Location:'.self::AUTH_CODE_URL.'?'.http_build_query($keysArr));
  42. }
  43. /**
  44. *
  45. * ?? ??? access_token ? open_id? ?????.
  46. *
  47. */
  48. ?? ?? ??()
  49. {
  50. $state = Session::get('state');
  51. // 驗(yàn)證state防止CSRF攻擊
  52. if (HttpRequest::getGet('state') != $state) throw_Exception('??? ???? ????. CSRF? ???? ? ????.');
  53. Session::set('state', null);
  54. $keysArr = array(
  55. 'grant_type' => 'authorization_code',
  56. 'client_id' => $this->appid,
  57. 'redirect_uri' => $ this->callbcak,
  58. 'client_secret' => $this->appkey,
  59. 'code' => HttpRequest::getGet('code')
  60. );
  61. $response =curlRequest(self::ACCESS_TOKEN_URL.'?'.http_build_query($keysArr));
  62. if(strpos($response, 'callback') !== false)
  63. {
  64. $lpos = strpos($response, '(');
  65. $rpos = strrpos($response, ')');
  66. $response = substr($response, $lpos 1, $rpos - $lpos -1) ;
  67. $msg = json_decode($response);
  68. if(isset($msg->error)) throw_Exception($msg->error.' '.$msg->error_description);
  69. }
  70. $params = array();
  71. parse_str($response, $params);
  72. Session::set('access_token', $params['access_token']);
  73. // 根據(jù)token請(qǐng)求獲取openid
  74. $response =curlRequest(self::OPENID_URL.'?access_token='.$params['access_token']);
  75. if(strpos($ ??, '??') !== false){
  76. $lpos = strpos($response, '(');
  77. $rpos = strrpos($response, ')');
  78. $response = substr($response, $lpos 1, $rpos - $lpos -1);
  79. }
  80. $user = json_decode($response);
  81. if(isset($user- >error)) throw_Exception($msg->error.' '.$msg->error_description);
  82. Session::set('open_id', $user->openid);
  83. ?? ?? ('??? ??' => $params['access_token'], 'open_id' => $user->openid);
  84. }
  85. /**
  86. *
  87. * ??? ???
  88. *
  89. */
  90. ?? ?? _initAPI()
  91. {
  92. $this->keysArr = array(
  93. 'oauth_consumer_key' => (int)$this->appid,
  94. 'access_token' => ??::get('access_token'),
  95. 'openid' => ??::get('open_id')
  96. );
  97. /**
  98. *
  99. * APIMap ???
  100. * ???? ??? ????? #? ?????. ??? ??? URL? ???? ????(? ????? URL? ???? ????). 'key' => 'val' ?? ???? ?? ??? ?????. ?? ?? ???? ?????. val
  101. * rule array(baseUrl, argListArr, method)
  102. *
  103. * @var array
  104. */
  105. $this->APIMap = array(
  106. /* qzone */
  107. 'add_blog' => array(
  108. 'https://graph.qq.com/blog/add_one_blog',
  109. array('title', 'format' => 'json', 'content' => null),
  110. 'POST'
  111. ),
  112. 'add_topic' => array(
  113. 'https://graph.qq.com/shuoshuo/add_topic',
  114. array('richtype','richval' ,'con','#lbs_nm','#lbs_x','#lbs_y','format' => 'json', '#third_source'),
  115. 'POST'
  116. ),
  117. 'get_user_info' => ??(
  118. 'https://graph.qq.com/user/get_user_info',
  119. ??('??' => 'json'),
  120. 'GET'
  121. ),
  122. 'add_one_blog' => array(
  123. 'https://graph.qq.com/blog/add_one_blog',
  124. array('title', 'content', 'format' => 'json'),
  125. 'GET '
  126. ),
  127. '?? ??' => array(
  128. 'https://graph.qq.com/photo/add_album',
  129. array('?? ??', '#albumdesc', '#priv', 'format' => 'json') ,
  130. '???'
  131. ),
  132. 'upload_pic' => array(
  133. 'https://graph.qq.com/photo/upload_pic',
  134. array('picture', '#photodesc', '#title', '#albumid', '#mobile', '#x', '#y', '#needfeed', '#successnum', '#picnum', 'format' => 'json'),
  135. 'POST'
  136. ),
  137. '??_??' => array(
  138. 'https://graph.qq.com/photo/list_album',
  139. array('format' => 'json')
  140. ),
  141. 'add_share' => array(
  142. 'https://graph.qq.com/share/add_share',
  143. array('??', 'url', '#comment','#summary','#images',' ??' => 'json','#type','#playurl','#nswb','site','fromurl'),
  144. 'POST'
  145. ),
  146. 'check_page_fans' => array(
  147. 'https://graph.qq.com/user/check_page_fans',
  148. array('page_id' => '314416946','format' => 'json')
  149. ) ,
  150. /* wblog */
  151. 'add_t' => array(
  152. 'https://graph.qq.com/t/add_t',
  153. array('format' => 'json', 'content','#clientip','#longitude', '#?????'),
  154. 'POST'
  155. ),
  156. 'add_pic_t' => array(
  157. 'https://graph.qq.com/t/add_pic_t',
  158. array('content', 'pic', 'format' => 'json', '#clientip', ' #??', '#??', '#syncflag', '# Compatiblefalg'),
  159. 'POST'
  160. ),
  161. 'del_t' => array(
  162. 'https://graph.qq.com/t/del_t',
  163. array('id', 'format' => 'json'),
  164. 'POST'
  165. ),
  166. 'get_repost_list' => array(
  167. 'https://graph.qq.com/t/get_repost_list',
  168. array('flag', 'rootid', 'pageflag', 'pagetime', 'reqnum', 'twitterid', '??' => 'json')
  169. ),
  170. 'get_info' => array(
  171. 'https://graph.qq.com/user/get_info',
  172. array('format' => 'json')
  173. ),
  174. 'get_other_info' => array(
  175. 'https://graph.qq.com/user/get_other_info',
  176. array('format' => 'json', '#name', 'fopenid')
  177. ),
  178. 'get_fanslist' => array(
  179. 'https://graph.qq.com/relation/get_fanslist',
  180. array('format' => 'json', 'reqnum', 'startindex', '#mode', ' #install', '#sex')
  181. ),
  182. 'get_idollist' => array(
  183. 'https://graph.qq.com/relation/get_idollist',
  184. array('format' => 'json', 'reqnum', 'startindex', '#mode', ' #??')
  185. ),
  186. 'add_idol' => array(
  187. 'https://graph.qq.com/relation/add_idol',
  188. array('format' => 'json', '#name-1', '#fopenids-1'),
  189. 'POST'
  190. ),
  191. 'del_idol' => array(
  192. 'https://graph.qq.com/relation/del_idol',
  193. array('format' => 'json', '#name-1', '#fopenid-1') ,
  194. 'POST'
  195. ),
  196. /* ?? */
  197. 'get_tenpay_addr' => array(
  198. 'https://graph.qq.com/cft_info/get_tenpay_addr',
  199. array('ver' => 1,'limit' => 5,'offset' => 0, 'format' => 'json')
  200. )
  201. );
  202. }
  203. ?? ?? _applyAPI($baseUrl, $argsList, $method)
  204. {
  205. $params = HttpRequest::getPost();
  206. $optionArgList = '';
  207. $keysArr = $this->keysArr;
  208. $pre = '#';
  209. foreach($ argsList as $k=>$v)
  210. {
  211. if(!is_string($k))
  212. {
  213. $k = $v;
  214. if(strpos($v, $ pre) === 0)
  215. {
  216. $v = $pre;
  217. $k = substr($k, 1);
  218. if(preg_match('/-(d$)/' , $k, $matchs))
  219. {
  220. $k = str_replace($matchs[0], '', $k);
  221. $optionArgList[$matchs[1]][] = $k ;
  222. }
  223. }
  224. else $v = null;
  225. }
  226. if(!isset($params[$k]) || $params[$k] === '' )
  227. {
  228. if($v == $pre) continue;
  229. elseif($v) $params[$k] = $v;
  230. else
  231. {
  232. if( isset($_FILES[$k]) && $_FILES[$k]['name']!='')
  233. {
  234. $uploadDir = getUploadAddr().'QQ'.__DS__;
  235. mk_dir ($uploadDir);
  236. $uploadObj = ? Upload();
  237. $fileInfo = $uploadObj->uploadOne($_FILES[$k], $uploadDir);
  238. $img = $uploadDir.$ fileInfo[0]['savename'];
  239. $params[$k] = "@{$img}";
  240. }
  241. else throw_Exception("param {$k} ?? ???? ????.") ;
  242. }
  243. }
  244. $keysArr[$k] = $params[$k];
  245. }
  246. // 檢查選填參數(shù)必填一? ???
  247. $i = 0;
  248. if(isset($optionArgList[1]))
  249. {
  250. foreach ($optionArgList[1] as $k=>$v) if(array_key_exists($v, $keysArr)) $i ;
  251. if(!$i) throw_Exception('QQ_api_param_error,['.implode(' ,', $optionArgList[1]).'] ??? ?? ??? ???.');
  252. }
  253. $baseUrl .= ($method == 'GET') ? '?'.http_build_query($keysArr) : '';
  254. $response =curlRequest($baseUrl, $keysArr, $method);
  255. return json_decode($response, true);
  256. }
  257. ?? ?? __call($name, $args)
  258. {
  259. $this->_initAPI();
  260. if(!array_key_exists($name, $this->APIMap) ) throw_Exception("QQ_api_{$name}?(?) ???? ????.");
  261. //從APIMap獲取api?應(yīng)參數(shù)
  262. $baseUrl = $this->APIMap[$name][0];
  263. $argsList = $this->APIMap[$name][1];
  264. $method = isset($this->APIMap[$name][2]) ? $this->APIMap[$name][2] : 'GET';
  265. $responseArr = $this->_applyAPI($baseUrl, $argsList, $method);
  266. //檢查返回ret判斷api是否成功調(diào)用
  267. if($responseArr['ret'] == 0) return $responseArr;
  268. else throw_Exception('QQ_API_'.$name.' [ret:'.$ responseArr['ret'].'] [errcode:'.$responseArr['errcode'].'] '.$responseArr['msg']);
  269. }
  270. }
復(fù)代碼


? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP?? ?? ???? ???? ???? ??? ?????? PHP?? ?? ???? ???? ???? ??? ?????? Jul 08, 2025 am 02:37 AM

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP?? ?? ?? PHP?? ?? ?? Jul 18, 2025 am 04:57 AM

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP?? ???? ??? ?????? PHP?? ???? ??? ?????? Jul 11, 2025 am 03:12 AM

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ?? ?? ? PHP ?? ?? ? Jul 18, 2025 am 04:51 AM

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

?? PHP : ??? ??? ?? PHP : ??? ??? Jul 18, 2025 am 04:54 AM

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

PHP?? ??? ? ???? ??? ????? ?? PHP?? ??? ? ???? ??? ????? ?? Jul 12, 2025 am 03:15 AM

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

?? PHP ?? ??? ?? PHP ?? ??? Jul 18, 2025 am 04:52 AM

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

See all articles