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条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效