您的位置:首页 > 其它

错误日志记录接口

2016-08-07 16:26 246 查看
通过app发送请求记录日志:

public function index(){
$this->check();
$errorLog = isset($_POST['error_log']) ? $_POST['error_log']:'';
if(!$errorLog){
return Response::show(401,'日志为空');
}
$sql = "INSERT INTO error_log(`app_id`,`did`,`version_id`,`version_mini`,`error_log`,`create_time`)VALUES(
".$this->params['app_id'].",
'".$this->params['did']."',
".$this->params['version_id'].",
".$this->params['version_mini'].",
'".$errorLog."',
".time()."
)";
$connect = Db::getInstance()->connect();
if(mysql_query($sql,$connect)){
return Response::show(200,'错误信息插入成功');
}else{
return Response::show(400,'错误信息插入失败');
}
}

以上内容有参考暮课网视频教程《PHP接口开发》
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: