您好,欢迎访问一九零五行业门户网

php微信接口

$contentstr =$view_sql.$view[title];
这句话可以返回sql语句,但是为什么不能讲数据查询出来呢。$view[title];
valid(); $wechatobj->responsemsg(); class wechatcallbackapitest { public function valid() { $echostr = $_get[echostr]; if($this->checksignature()){ echo $echostr; exit; } } public function responsemsg() { $poststr = $globals[http_raw_post_data]; if (!empty($poststr)){ $postobj = simplexml_load_string($poststr, 'simplexmlelement', libxml_nocdata); $fromusername = $postobj->fromusername; $tousername = $postobj->tousername; $keyword = trim($postobj->content); $time = time(); $texttpl = %s 0 ; if(!empty( $keyword )) { $view_sql=select * from news where title like '%$keyword%'; $view=mysql_fetch_array(mysql_query($view_sql)); $msgtype = text; $contentstr =$view_sql.$view[title]; //$contentstr = $view[title]; $resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr); echo $resultstr; }else{ echo mess; } }else { echo mess; exit; } } private function checksignature() { $signature = $_get[signature]; $timestamp = $_get[timestamp]; $nonce = $_get[nonce]; $token =token; $tmparr = array($token, $timestamp, $nonce); sort($tmparr); $tmpstr = implode( $tmparr ); $tmpstr = sha1( $tmpstr ); if( $tmpstr == $signature ){ return true; }else{ return false; } } } ?>
回复讨论(解决方案) 没有人支持一下呢,这个问题困扰我很长时间了
还是没有人回复,真是可怜
没怎么看懂,你是说$view[title]没有值吗
是的,我也搞不清楚了,很简单的东西,sql语句查询,查询后自动回复。弄的我都死了
我基本找到问题了,可能我的mysql是gbk的编码,而微信是utf8编码的
这样就造成查询不出数据
其它类似信息

推荐信息