What are the detailed tips in the file tips-1048079-04.php?
- 内容介绍
- 文章标签
- 相关推荐
本文共计241个文字,预计阅读时间需要1分钟。
php修改后的代码:wechat.inc.php_appid=$appid;$_appsecret=$appsecret;$_token=$token;
public function valid() { $echoStr=$_GET[echostr]; // 验证签名 if ($_this->checkSignature()) { echo $echoStr; exit; }}
tips-1048079-04.phpwechat.inc.php
_appid = $appid;
$this->_appsecret = $appsecret;
$this->_token = $token;
}
public function valid()
{
$echoStr = $_GET["echostr"];
//valid signature , option
if($this->checkSignature())
{
echo $echoStr;
exit;
}
}
public function responseMsg()
{
//get post data, May be due to the different environments
$postStr = file_get_contents("php://input");
//extract post data
if (!empty($postStr))
{
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
if (!empty($postObj))
{
switch($postObj->MsgType)
{
case 'text':
$this->_doText($postObj);
break;
default: exit;
}
}
}
else
{
echo "";
exit;
}
}
private function _doText($postObj)
{
$fromUsername = $postObj->FromUserName;
$toUsername = $postObj->ToUserName;
$keyword = trim($postObj->Content);
$time = time();
$textTpl = "
本文共计241个文字,预计阅读时间需要1分钟。
php修改后的代码:wechat.inc.php_appid=$appid;$_appsecret=$appsecret;$_token=$token;
public function valid() { $echoStr=$_GET[echostr]; // 验证签名 if ($_this->checkSignature()) { echo $echoStr; exit; }}
tips-1048079-04.phpwechat.inc.php
_appid = $appid;
$this->_appsecret = $appsecret;
$this->_token = $token;
}
public function valid()
{
$echoStr = $_GET["echostr"];
//valid signature , option
if($this->checkSignature())
{
echo $echoStr;
exit;
}
}
public function responseMsg()
{
//get post data, May be due to the different environments
$postStr = file_get_contents("php://input");
//extract post data
if (!empty($postStr))
{
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
if (!empty($postObj))
{
switch($postObj->MsgType)
{
case 'text':
$this->_doText($postObj);
break;
default: exit;
}
}
}
else
{
echo "";
exit;
}
}
private function _doText($postObj)
{
$fromUsername = $postObj->FromUserName;
$toUsername = $postObj->ToUserName;
$keyword = trim($postObj->Content);
$time = time();
$textTpl = "

