if (strtolower($postObj->MsgType) == 'text' && trim($postObj->Content) == '图文') {
$arr = array(
array(
'title' => 'hello world!',
'description' => '百度一下,你就知道',
'picurl' => 'https://www.baidu.com/img/bdlogo.png',
'url' => 'https://www.baidu.com'
),
array(
'title' => '优酷',
'description' => '这世界很酷',
'picurl' => 'https://www.baidu.com/img/bdlogo.png',
'url' => 'https://www.youku.com'
),
);
$indexModel = new IndexModel;
$indexModel->responseNews($postObj,$arr);
}else{
//如果用户发送文本信息
switch($postObj->Content) {
case 'hi':
$content = '你好啊!';
break;
case '日期':
$content = "你好!现在是\n".date("Y年m月d日 H点i分s秒");
break;
default:
$content = "您可以尝试输入 hi、今天日期、图文";
break;
}
$indexModel = new IndexModel;
$indexModel->responseText($postObj,$content);
}