作者 郭文星

111

@@ -94,6 +94,17 @@ class Index extends Api @@ -94,6 +94,17 @@ class Index extends Api
94 */ 94 */
95 public function senWxmsgToAgentUser($titdesc="", $remark="") 95 public function senWxmsgToAgentUser($titdesc="", $remark="")
96 { 96 {
  97 + $appid = 'wxb7dd0c03865a94e0';
  98 + $appsecret = '6af75a6fb8211da45631630e34769f82';
  99 + $code = $_GET['code']; // 从回调URL中获取code参数
  100 +
  101 +// 获取access_token
  102 + $token_url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code";
  103 + $token_json = file_get_contents($token_url);
  104 + $token_array = json_decode($token_json, true);
  105 + print_r($token_array);return;
  106 +
  107 +
97 $wxopenid="ojyUX6oNFoQMqoCd1JWtfwQs-CeA"; 108 $wxopenid="ojyUX6oNFoQMqoCd1JWtfwQs-CeA";
98 $sendInfo = array( 109 $sendInfo = array(
99 'first' => array('value' => urlencode($titdesc), 'color' => "#743A3A"), 110 'first' => array('value' => urlencode($titdesc), 'color' => "#743A3A"),