关于php微信平台自定义菜单响应的问题,我写的是被注释掉的switch语句,但是不成功
if($MsgType=='event'){$MsgEvent=$postObj->Event;if($MsgEvent=='subscribe'){$arr[]="[愉...
if($MsgType=='event'){
$MsgEvent = $postObj->Event;
if ($MsgEvent=='subscribe') {
$arr[] = "[愉快]";
echo $this->make_xml("text",$arr);
exit;
}else if ($MsgEvent=='CLICK') {
$EventKey = $postObj->EventKey;
// $EventKey = trim($postObj->EventKey);
$arr[] = $EventKey;
/*******************************/
/* switch ($EventKey)
{
case "VCX_ABOUTME":
$arry[]="Hello world";
//$arr[] = $EventKey;
echo $this->make_xml("text",$arr);
break;
// case "VCX_JOBINFORMATION":
// $arry[]=$EventKey ;
// echo $this->make_xml("news",$arr);
// break;
default:
$arry[] = "What did you say".$EventKey;
echo $this->make_xml("text",$arr);
break;
}
/**********************************/
echo $this->make_xml("text",$arr);
exit;
}
}
}else {
echo "this a file for weixin API!";
exit;
} 展开
$MsgEvent = $postObj->Event;
if ($MsgEvent=='subscribe') {
$arr[] = "[愉快]";
echo $this->make_xml("text",$arr);
exit;
}else if ($MsgEvent=='CLICK') {
$EventKey = $postObj->EventKey;
// $EventKey = trim($postObj->EventKey);
$arr[] = $EventKey;
/*******************************/
/* switch ($EventKey)
{
case "VCX_ABOUTME":
$arry[]="Hello world";
//$arr[] = $EventKey;
echo $this->make_xml("text",$arr);
break;
// case "VCX_JOBINFORMATION":
// $arry[]=$EventKey ;
// echo $this->make_xml("news",$arr);
// break;
default:
$arry[] = "What did you say".$EventKey;
echo $this->make_xml("text",$arr);
break;
}
/**********************************/
echo $this->make_xml("text",$arr);
exit;
}
}
}else {
echo "this a file for weixin API!";
exit;
} 展开
2个回答
展开全部
if($MsgType=='event'){
$MsgEvent = $postObj->Event;
if ($MsgEvent=='subscribe') {
$arr[] = "[愉快]";
echo $this->make_xml("text",$arr);
exit;
}else if ($MsgEvent=='CLICK') {
$EventKey = $postObj->EventKey;
// $EventKey = trim($postObj->EventKey);
$arr[] = $EventKey;
/*******************************/
/* switch ($EventKey)
{
case "VCX_ABOUTME":
$arry[]="Hello world";
//$arr[] = $EventKey;
echo $this->make_xml("text",$arr);
break;
// case "VCX_JOBINFORMATION":
// $arry[]=$EventKey ;
// echo $this->make_xml("news",$arr);
// break;
default:
$arry[] = "What did you say".$EventKey;
echo $this->make_xml("text",$arr);
break;
}
*/
/**********************************/
echo $this->make_xml("text",$arr);
exit;
}
}
}else {
echo "this a file for weixin API!";
exit;
}
$MsgEvent = $postObj->Event;
if ($MsgEvent=='subscribe') {
$arr[] = "[愉快]";
echo $this->make_xml("text",$arr);
exit;
}else if ($MsgEvent=='CLICK') {
$EventKey = $postObj->EventKey;
// $EventKey = trim($postObj->EventKey);
$arr[] = $EventKey;
/*******************************/
/* switch ($EventKey)
{
case "VCX_ABOUTME":
$arry[]="Hello world";
//$arr[] = $EventKey;
echo $this->make_xml("text",$arr);
break;
// case "VCX_JOBINFORMATION":
// $arry[]=$EventKey ;
// echo $this->make_xml("news",$arr);
// break;
default:
$arry[] = "What did you say".$EventKey;
echo $this->make_xml("text",$arr);
break;
}
*/
/**********************************/
echo $this->make_xml("text",$arr);
exit;
}
}
}else {
echo "this a file for weixin API!";
exit;
}
追问
这个改了哪儿?能标出来吗
追答
$arry[] = "What did you say".$EventKey;
echo $this->make_xml("text",$arr);
break;
}
*/
就多加了这个 */
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
没懂你问题- -
追问
就是这个里面我注释掉了自己写的switch,这段代码可以运行,结果是直接返回evenkey的值,但是我想根据判断evenkey的值,返回不同的东西
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询