Benutzerdefiniertes Antwortbild, Antwortbild und -text

Erstellen Sie eine Klassendatei AutoreplyController.class.php

Codebeispiel:

//自定义回复图片
  public function index1(){
    $this->display('replyimage');
  }

public function upload(){
     $upload = new \Think\Upload();//实例化上传类
         $upload ->maxSize =3145728;//设置 文件的大小
         $upload ->exts = array('jpg','gif','png','jpeg');//设置文件上传类型
         $upload ->rootPath ='./Uploads/';//设置文件上传路径
         $upload ->savePath='';//设置文件上传子目录

         $info = $upload->uploadOne($_FILES['file']);
         if(!$info){
          $this->ajaxReturn(array('code'=>1,'msg'=>$upload->getError()));
         }else{
          $file ='/Uploads/'.$info['savepath'].$info['savename'];
          $this->ajaxReturn(array('code'=>0,'msg'=>'上传成功','url'=>$file));
         }

おすすめ

転載: blog.csdn.net/TIANJING_er/article/details/80013374