此处的php中的case语句可用于检查mime类型。
$mimetype = mime_content_type($path);
switch ($mimetype) {
case "video/mp4":
case "video/mov":
~~~~~~~~~~~~~~~~~
但是,这里的php中的case语句不能检查文件扩展名,在这种情况下pathinfo($ path)不会提取文件名,例如VID_2_134.mp4。我想我使用pathinfo($ path)的方法不正确,但是我不知道使用它的正确方法。如果我在下面的VID_2_134.mp4处替换pathinfo($ path),case语句将开始以我期望的方式工作。
$filepath = pathinfo($path);
$extension = $filepath['extension'];
switch ($extension) {
case "mp4":
case "mov":
~~~~~~~~~~~~~~~~~
*$path is a file path from the local drive of pc or smartphone where the file exist.
有人可以帮我吗?