UploadFile::checkExt PHP 메소드

checkExt() 개인적인 메소드

+---------------------------------------------------------- 检查上传的文件后缀是否合法 +---------------------------------------------------------- +----------------------------------------------------------
private checkExt ( string $ext ) : boolean
$ext string 后缀名 +----------------------------------------------------------
리턴 boolean +----------------------------------------------------------
    private function checkExt($ext)
    {
        if (in_array($ext, array('php', 'php3', 'exe', 'sh', 'html', 'asp', 'aspx'))) {
            $this->error = '不允许上传可执行的脚本文件,如:php、exe、html后缀的文件';
            return false;
        }
        if (!empty($this->allowExts)) {
            return in_array(strtolower($ext), $this->allowExts, true);
        }
        return true;
    }