tp5 视频上传及展示

	//渲染视频页面
	public function upload(){
		return $this->fetch('up');
	}
	//视频展示
	public function listv(){
		$re=Db::query('select * from sg_fruits where f_id = 78');
		$this->view->engine->layout(true);
	    $res=$re[0]['f_img'];

		$this->assign('res',$res);
		return view();


	}

//接上传的值
	public function jie(){
//		print_r($_FILES["file"]);die;
		$myfile=$_FILES["file"];
		$tmp=$myfile['tmp_name'];
		$a='uploads/'.time().'.mp4';
		$path=ROOT_PATH .'public/'.$a ;

     $data['f_img']=$a;
		if(!move_uploaded_file($tmp,$path)) die('视频上传失败');
		$num= \think\Db::table('sg_fruits')->insert($data);
		if($num){
			$this->redirect("goods/listv");

		}

	}


 
  



    
    Document



        视频播放
        

你可能感兴趣的:(tp5)