0

我正在处理drupal中的文件。我将本地 wamp 服务器与 drupal6 一起使用。
我的drupal 路径是localhost/drupal6。我在这个路径中有一个文件<drupal root >\files\images\111.jpg

$image='/drupal6/files/images/111.jpg';

我想将此文件复制(或移动)到此路径中的另一个子文件夹,但在 phpcopy($image,'anotherdestination')drupal_copy($image,'anotherdestination',FILE_EXISTS_RENAME).

当我使用var_dump(file_check_path($image));它时,我返回falsefilesand文件夹对iamgesWindows 中的任何用户都具有所有权限。哪里有问题?

注意:我在带有路径的自定义模块中的函数中编写了所有这些代码sites/all/module/mymodule/mymodule.module

4

1 回答 1

1

通过 HTTP 和通过文件系统访问文件的方式有所不同。Over web/drupal6/files/images/111.jpg非常好,因为它会被评估为http://example.com/drupal6/files/images/111.jpg. drupal6但我敢打赌,您的文件系统的根目录中没有目录。

你可能想要这样的东西。

copy('c:\drupal6\files\images\111.jpg', 'c:\drupal6\files\other_images\111.jpg');

我不完全确定 Windows 中的路径,但我认为这应该是正确的。

于 2012-06-27T08:29:45.567 回答