PHP重命名错误
当使用重命名函数
Warning: rename(../data/feeds/feed2.txt,../data/feeds/feed3.txt) [function.rename]: No error in C:\wamp\www\cms\admin\pages\feeds.php on line 32
“../data/feeds/feed2.txt”是正确的路径时,我收到此错误,我已经完成了 include("../data/feeds/feed2.txt") 并且它显示了该文件。并且“../data/feeds/feed3.txt”不存在。
有谁知道这是什么原因造成的?
I get this error when using the rename function
Warning: rename(../data/feeds/feed2.txt,../data/feeds/feed3.txt) [function.rename]: No error in C:\wamp\www\cms\admin\pages\feeds.php on line 32
"../data/feeds/feed2.txt" is the correct path, I have done include("../data/feeds/feed2.txt") and it displays the file. And "../data/feeds/feed3.txt" doesn't exist.
Anyone know what's causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该检查“../data/feeds/feed2.txt”是否可读以及“../data/feeds/feed3.txt”是否可写...
you should check if "../data/feeds/feed2.txt" is readable and if "../data/feeds/feed3.txt" is writable...
您是否将字符串括在引号中?
Did you enclose strings in quotes?
您可以在 try-catch 语句中使用:
copy( $old_name, $new_name ); unlink($old_name);
只是您必须确保该目录是可写的。
在您的情况下,您必须确保该目标文件存在或使用绝对文件路径
You can use in try-catch statements :
copy( $old_name, $new_name ); unlink($old_name);
Just you must be sure that directory is writable.
In your case u must be sure that this destination file is exists or use absolute file paths