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.
执行以下步骤以清楚地了解问题:
预期:上传时显示错误
实际:文件很容易上传,没有任何问题,只有在访问它时才会出现错误。
mime_content_type() 是不推荐使用的函数。相反,您可以使用
<?php print_r(getimagesize("listing.png")); ?>
如果这显示错误,则该文件是无效的 png 文件。如果文件有效,则返回一个信息数组。
编辑:如果您仅使用图像,则此方法有效。