tp6 文件类型验证

时间:2020-09-16 14:44:45   收藏:0   阅读:415
public function test(){
        try {
            $file=$this->request->file();
            $res=validate([‘file‘=>‘fileExt:xlsx,jpg‘],[],false,false)
                ->check($file);
            if(!$res){
                return ‘文件格式不正确‘;
            }
        }catch (Exception $e){
        }
    }

 

原文:https://www.cnblogs.com/CanyingV/p/13678920.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!