Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试获取用户上传图像的文件扩展名,我了解到有几种方法可以实现这一目标。我认为这是目前获取文件扩展名的对话方式:
$ext = pathinfo($_FILES["userfile"]["name"], PATHINFO_EXTENSION);
但是,我发现以下方法更直观和令人难忘:
list(,$ext) = explode("/", $_FILES["userfile"]["type"]);
采用后一种方法有什么缺点?