public function add_inform()
{
$data['z_title'] = input('post.z_title');
$data1['content'] = input('post.content');
$data['z_time'] = time();
$file = request()->file('z_img');
$info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
if($info){
// 成功上传后 获取上传信息
$a = $info->getSaveName();
$imgp = str_replace("\\","/",$a);
$imgpath = 'uploads/'.$imgp;
$data['z_img'] = $imgpath;
$res = db('information')->insertGetId($data);
if($res)
{
$data1['z_id']=$res;
}
$res1 = db('detainform')->insert($data1);
if($res1)
{
$this->success("添加成功",'add_information');
}
else
{
$this->error("添加失败");
}
}else{
// 上传失败获取错误信息
echo $file->getError();
}
}