Thinkphp+聚合接口制作的聊天小黄鸡,附源码下载

浏览:2292 发布日期:2016/09/30 分类:系统代码 关键字: 接口 API thinkphp 小黄鸡 SUCaime小黄鸡
如果你下载下来了,你一定要善待这只鸡。下载下来打开就可以聊天!我放到了我的服务器上,国庆期间我无聊就找鸡。
希望大家多多支持我在看云发布的手册,第一章对登录讲解的超级详细。http://www.kancloud.cn/w113211/killall《基于ThinkPHP5.0的各项后台小功能代码实现》
[/img]
ThinkPhP两个版本的权限管理(3.2.3和5.0)
https://www.kancloud.cn/w113211/alls


http://www.wbaobao.top/talkJJ/
代码核心就是调用接口跟前台的输出js的使用方法。
它可能没有你想象的那么黄,最黄的在韩国。<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        $this->display();
    }
    public function data(){
        if (IS_POST) {
            $appkey = "5e70fea5553d2deea473c13b516a564a";
            $url = "http://op.juhe.cn/robot/index";
            $metock=I("post.txt","haha");
            $params = array(
                  "key" => $appkey,//您申请到的本接口专用的APPKEY
                  "info" => $metock,//要发送给机器人的内容,不要超过30个字符
                  "dtype" => "",//返回的数据的格式,json或xml,默认为json
                  "loc" => "",//地点,如北京中关村
                  "lon" => "",//经度,东经116.234632(小数点后保留6位),需要写为116234632
                  "lat" => "",//纬度,北纬40.234632(小数点后保留6位),需要写为40234632
                  "userid" => "",//1~32位,此userid针对您自己的每一个用户,用于上下文的关联
            );
            $params=http_build_query($params);
            $ispost=0;
            $httpInfo = array();
            $ch = curl_init();
            curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
            curl_setopt( $ch, CURLOPT_USERAGENT , 'JuheData' );
            curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );
            curl_setopt( $ch, CURLOPT_TIMEOUT , 60);
            curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );
            $response = curl_exec( $ch );
            if ($response === FALSE) {
                return false;
            }
            $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );
            $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );
            curl_close( $ch );
            $data=json_decode($response,ture)["result"]["text"];
            $return=[
                "text"=>$data,
            ];
            $this->ajaxReturn($return);
        }
    }
}

附件 talkJJ.rar ( 1.25 MB 下载:120 次 )

评论( 相关
后面还有条评论,点击查看>>