3

我在 Internet Explorer 中取消图像链接时遇到问题,但它在 Mozilla 中有效。

我使用了php代码:

<?php

unlink("./product_photos/".$name);


?>
4

1 回答 1

1

PHP 不受浏览器怪癖的影响。

如果unlink()失败,则可能与您的 PHP 有关。文件路径是否指向文件?var_dump(file_exists("./product_photos/".$name));删除之前说什么?如果不是(bool) true,那就是你的问题:)

$name如果它来自用户,还要确保它已被清理,否则我可能会进入../../../your-site/index.php(目录遍历攻击)。

于 2011-04-02T09:35:51.587 回答