Upload.php 529 B

1234567891011121314151617181920
  1. <?php
  2. namespace app\admin\controller;
  3. use app\BaseController;use think\App;
  4. class Upload extends Base{
  5. public function __construct(App $app) {parent::__construct($app);}
  6. //图片上传接口;
  7. public function UploadImg(){
  8. $img =$this->request->file('img');
  9. if(!isset($img)||empty($img) ||$img==''){
  10. return error_show(1004,"参数 img 不能为空");
  11. }
  12. $data =UploadImg($img);
  13. if(is_array($data)) return app_show(0,"上传成功",$data); else return error_show(1004,"上传失败");
  14. }
  15. }