doufei9805
2010-07-13 04:34
浏览 53
已采纳

PHP副本说文件不存在

im using the following code;

if( ! file_exists( $path ) ) { die( "'" . $path . "' not vaild path"); }
copy( $path, ltrim($create_folder . ltrim($path, "./"), ".") );
echo "'" . $path. "' => '" . $create_folder . ltrim($path, "./") . "'<br />";

The first if statement returns true yet the copy function returns;

Warning: copy('./files/c7a628cba22e28eb17b5f5c6ae2a266a/0003.css') [function.copy]: failed to open stream: No such file or directory

'./files/c7a628cba22e28eb17b5f5c6ae2a266a/0003.css' => './224efcdebda48350056af291f64a9311/files/8b571e7fbf9bacf4473024b11f78bc0dfiles/c7a628cba22e28eb17b5f5c6ae2a266a/0003.css'

If anyone knows why it would be much appreciated.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douniuta4783 2010-07-13 04:38
    已采纳

    You might notice that your second half is missing a slash. As in, one of your path elements is "8b571e7fbf9bacf4473024b11f78bc0dfiles" instead of "8b571e7fbf9bacf4473024b11f78bc0d/files". Try $create_folder . '/' . ltrim($path, "./")

    But the real answer is "your file actually does not exist. No, really, PHP is correct". It's just talking about the destination not existing; the source is fine.

    点赞 评论

相关推荐 更多相似问题