不走else區(qū)間 這樣的情況有大佬出現過嗎
不用框架的時候 都好使 用了tp5? 然后用的route路由 微信配置中的url是?http://www.xxxx/api/wei/check? token 認證是可以的 我在else區(qū)間調用了關注回復 但是沒有回復? 然后我調用了自定義菜單(測試走不走else區(qū)間)還是不行 單獨用自定義菜單是可以的 哪位大佬出現過這個情況
public function check_wei()
? ? {
? ? ? ? if(isset($_GET['echostr'])) {
? ? ? ? ? ? $nonce? ? ?= $_GET['nonce'];
? ? ? ? ? ? $token? ? ?= 'bijiwang123456';
? ? ? ? ? ? $timestamp = $_GET['timestamp'];
? ? ? ? ? ? $echostr? ?= $_GET['echostr'];
? ? ? ? ? ? $signature = $_GET['signature'];
? ? ? ? ? ? $array = array($nonce, $timestamp, $token);
? ? ? ? ? ? sort($array);
? ? ? ? ? ? $str = sha1(implode($array));
? ? ? ? ? ? if($str == $signature ) {
? ? ? ? ? ? ? ? echo $echostr;?
? ? ? ? ? ? ? ? exit;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? ?$this->sendMsg();
? ? ? ??
? ? }
? ? public function sendMsg()
? ? {
? ? ? ? $post_data = file_get_contents('php://input');//獲得微信推送過得post數據(xml格式)
? ? ? ? file_put_contents('ceshi.txt',$post_data);
? ? ? ? $post_obj = simplexml_load_string($post_data);//處理消息
? ? ? ? if(strtolower($post_obj->MsgType) == 'event') {//判斷是否是訂閱的時間推送
? ? ? ? ? ? if(strtolower($post_obj->Event) == 'subscribe') {//判斷是否是關注事件
? ? ? ? ? ? ? ? $toUser = $post_obj->FromUserName;
? ? ? ? ? ? ? ? $fromUser = $post_obj->ToUserName;
? ? ? ? ? ? ? ? $time = time();
? ? ? ? ? ? ? ? $msgType = 'text';
? ? ? ? ? ? ? ? $content = '歡迎關注';
? ? ? ? ? ? ? ? $template = "
? ? ? ? ? ? ? ? ? ? <xml>
? ? ? ? ? ? ? ? ? ? <ToUserName><![CDATA[%s]]></ToUserName>
? ? ? ? ? ? ? ? ? ? <FromUserName><![CDATA[%s]]></FromUserName>
? ? ? ? ? ? ? ? ? ? <CreateTime>%s</CreateTime>
? ? ? ? ? ? ? ? ? ? <MsgType><![CDATA[%s]]></MsgType>
? ? ? ? ? ? ? ? ? ? <Content><![CDATA[%s]]></Content>
? ? ? ? ? ? ? ? ? ? </xml>
? ? ? ? ? ? ? ? ";
? ? ? ? ? ? ? ? $info = sprintf($template,$toUser,$fromUser,$time,$msgType,$content);
? ? ? ? ? ? ? ? echo $info;
? ? ? ? ? ? }
? ? ? ? }
? ? }