Home > php教程 > php手册 > Chat little yellow chicken made by Thinkphp + aggregation interface, with source code download

Chat little yellow chicken made by Thinkphp + aggregation interface, with source code download

WBOY
Release: 2016-10-09 08:32:16
Original
1548 people have browsed it

If you download it, you must treat this chicken well. Download it and open it to chat! I put it on my server. During the National Day, I looked for chickens when I was bored.
http://www.wbaobao.top/talkJJ/
The core of the code is the method of calling the interface and the front-end output js.
It may not be as yellow as you think, the most yellow is in Korea. <?php <br /> namespace HomeController;<br> use ThinkController;<br> class IndexController extends Controller {<br> Public function index(){<br>           $this->display();<br> }<br> Public function data(){<br>            if (IS_POST) {<br>             $appkey = "5e70fea5553d2deea473c13b516a564a";<br>              $url = "http://op.juhe.cn/robot/index";<br>              $metock=I("post.txt","haha");<br>                $params = array(<br> "key" => $appkey,//The APPKEY you applied for for this interface<br> "info" => $metock,//The content to be sent to the robot should not exceed 30 characters<br> "dtype" => "",//The format of the returned data, json or xml, the default is json<br> "loc" => "",//Location, such as Zhongguancun, Beijing<br> "lon" => "",//Longitude, east longitude 116.234632 (retain 6 decimal places), need to be written as 116234632<br> "lat" => "",//Latitude, north latitude 40.234632 (retain 6 digits after the decimal point), need to be written as 40234632<br> "userid" => "",//1~32 digits, this userid is for each of your own users and is used for contextual association<br> );<br>                 $params=http_build_query($params);<br>                 $ispost=0;<br>                $httpInfo = array();<br>                $ch = curl_init();<br>             curl_setopt( $ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);<br>             curl_setopt( $ch, CURLOPT_USERAGENT, 'JuheData' );<br>               curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 60);<br>              curl_setopt( $ch, CURLOPT_TIMEOUT, 60);<br>              curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );<br>              curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);<br> curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );<br>              $response = curl_exec( $ch );<br>                 if ($response === FALSE) {<br>                                                                                                                                                                                                                                                           return false              }<br>              $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE);<br>            $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );<br>             curl_close( $ch );<br>             $data=json_decode($response,ture)["result"]["text"];<br>             $return=[<br>                 "text"=>$data,<br>             ];<br>             $this->ajaxReturn($return);<br>         }<br>     }<br> }

Chat little yellow chicken made by Thinkphp + aggregation interface, with source code download talkJJ.rar ( 1.25 MB 下载:63 次 )

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template