第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

正在回答

6 回答

請(qǐng)問(wèn),你解決了嗎

0 回復(fù) 有任何疑惑可以回復(fù)我~

$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];很可能是這行代碼有問(wèn)題,這行代碼我是獲取不到數(shù)據(jù)的,所以進(jìn)不了判斷。$postStr =file_get_contents("php://input"); 改用這句就可以獲取xml數(shù)據(jù),然后進(jìn)入判斷了。

0 回復(fù) 有任何疑惑可以回復(fù)我~

這個(gè)是代碼? token已經(jīng)配置成功了 大神看看為啥關(guān)注成功不回復(fù)消息?

0 回復(fù) 有任何疑惑可以回復(fù)我~

<?php

namespace app\index\controller;


class Index

{

public function index(){

//獲得參數(shù) signature nonce token timestamp echostr

$nonce? ? ?= $_GET['nonce'];

$token? ? ?= 'imooc';

$timestamp = $_GET['timestamp'];

$echostr? ?= $_GET['echostr'];

$signature = $_GET['signature'];

//形成數(shù)組,然后按字典序排序

$array = array();

$array = array($nonce, $timestamp, $token);

sort($array);

//拼接成字符串,sha1加密 ,然后與signature進(jìn)行校驗(yàn)

$str = sha1( implode( $array ) );

if( $str == $signature && $echostr){

//第一次接入weixin api接口的時(shí)候

echo? $echostr;

exit;

}else{

$this->reponseMsg();

}

}

public function reponseMsg(){

$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];

? ? ? ? //??xmlêy?Y°ü×a3é???ó

? ? ? ? $postObj = simplexml_load_string($postStr);

? ? ? ? $fromUsername = $postObj->FromUserName;

? ? ? ? $toUsername = $postObj->ToUserName;

? ? ? ? $time = time();

? ? ? ? if(strtolower($postObj->MsgType) == 'event') {

//判斷如果是關(guān)注

? ? ? ? if(strtolower($postObj->Event) == 'subscribe'){

? ? ? ? ? ? ? ? $textTpl = "<xml>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <ToUserName><![CDATA[%s]]></ToUserName>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <FromUserName><![CDATA[%s]]></FromUserName>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <CreateTime>%s</CreateTime>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <MsgType><![CDATA[%s]]></MsgType>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? <Content><![CDATA[%s]]></Content>

? ? ? ? ? ? ? ? ? ? ? ? ? ? </xml>";

? ? ? ? ? ? ? ? $msgType = "text";

? ? ? ? ? ? ? ? $contentStr = "謝謝關(guān)注000";

? ? ? ? ? ? ? ? $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);

? ? ? ? ? ? ? ? echo $resultStr;

? ? ? ? ? ? }


? ? ? ? }

}//reponseMsg end

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

我的也不行,怎么解決?。啃值?/p>


0 回復(fù) 有任何疑惑可以回復(fù)我~

不進(jìn)else多半是代碼有錯(cuò),要貼代碼才好找

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

to ken 配置成功 就是關(guān)注不回復(fù)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)