此次实现的api来自虫洞,感谢作者为我们提供这些接口.因为是调用api接口,所以很操作很简单.效果图如下
1、主页面
2、列表页面
4.1:公交查询
4.2:百科.
4.3:提问, 4.4:词典
4.5:诗词
代码如下
1、共同操作
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
private function _bug_comm( $msg , $appid ){ $param = array ( "ch" => "1001" , //以区分请求来源 "type" => "wap" , "appid" => "$appid" , "info" => "$msg" ); $content = str_replace ( "<br>" , "\n" , $msg ); $content .= "\n\n小助手:回复
@ 进入主界面" ; return array ( $content , "text" ); } |
2、实现代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
//公交 private function get_bus( $find_name ){ return $this ->_bug_comm( $find_name , "11" ); } //百科 private function get_wiki( $find_name ){ return $this ->_bug_comm( $find_name , "111" ); } //提问 private function get_ask( $find_name ){ return $this ->_bug_comm( $find_name , "121" ); } //词典 private function get_dict( $find_name ){ return $this ->_bug_comm( $find_name , "431" ); } //诗词 private function get_poem2( $find_name ){ return $this ->_bug_comm( $find_name , "531" ); } |
oK,感谢浏览。
原文:http://blog.csdn.net/w116858389/article/details/18552259