douxuanling6523 2014-04-12 01:41
浏览 18
已采纳

在注销时重命名文件

I'm trying to rename a file with PHP but for some reason it doesnt work, do I have to activate some special permissions under PHP?

heres my code for the php file

<?php
  if(!rename('file.php','filer.php'))
  {
    echo "Couldn't rename file!";
  }
  else 
  {
    echo "file renamed succesfully!";
  }
?>

I'm trying to rename a file on my /var/www directory when they sign out of a login area, so that way they cant access back hitting back button. Do I have an error on my code? Or is there another way to prevent this?

  • 写回答

3条回答 默认 最新

  • doulu8341 2014-04-12 02:05
    关注

    The Default permissions on this folder /var/www/ are: chmod 755 /var/www/

    "read, write, and execute by owner" and "read and execute by the group and everyone else" (-rwxr-xr-x)

    and the files inside the folder /var/www/file are: chmod 644 /var/www/file

    I don't know if you have changed the Permissions or simply execute this command and it we'll work.

    chmod 777 /var/www/file.php

    "read, write, and execute by owner, group and everyone else"

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?