donglian2106 2011-11-28 13:48
浏览 331

我对文件有写权限,但我不能使用“unlink()”函数删除它

I've Googled around a bit, and can't find any answer that works for me. I'm trying to unlink a file, but nothing happens and no errors appear (display_errors() stopped the page from loading). The code is below. Thanks!

 chdir("/var/www/lib.techtri.be/");
 unlink("/var/www/lib.techtri.be/R1Count.txt");

Edit: I know the chdir isn't needed, that's just for the later parts in the file.

  • 写回答

1条回答 默认 最新

  • douxiluan6555 2011-11-28 13:51
    关注

    You can only delete a file if you also have write permission on the directory containing it.

    % mkdir foo
    % touch foo/bar
    % chmod u-w foo
    % rm foo/bar
    rm foo/bar: Permission denied
    
    评论

报告相同问题?

悬赏问题

  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图