码迷,mamicode.com
首页 > Windows程序 > 详细

PHP API接口接受post数据。。file_get_contents 把整个文件一次性读入一个字符串中。

时间:2019-12-16 17:52:05      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:访问   size   col   function   else   val   info   字符   pre   

 

主要就是这个函数:file_get_contents  把整个文件一次性读入一个字符串中。

 

//言通智能客服API接口
    public function yantong_ai(){
        if(IS_POST){
            $val[‘text‘] = file_get_contents($_POST);//API  json数据
            $val[‘ctime‘] = time();//时间戳
            $add = M(‘ai_jilu‘)->add($val);//写入数据
            if($add){
                $state[‘status‘] = 1;
                $this->ajaxReturn($state);
            }else{
                $state[‘status‘] = 0;
                $this->ajaxReturn($state);
            }

        }else{
            $state[‘status‘] = 0;
            $state[‘info‘] = ‘无权访问‘;
            $this->ajaxReturn($state);
        }
    }

 

PHP API接口接受post数据。。file_get_contents 把整个文件一次性读入一个字符串中。

标签:访问   size   col   function   else   val   info   字符   pre   

原文地址:https://www.cnblogs.com/zc290987034/p/12050022.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!