PHP 没有正确复制文件

PHP does not copy the file properly

我正在从另一个域复制文件。它没有给我任何错误,但是文件没有被识别并且它的大小与原始文件不同。它与我检查过的扩展名相同。所以我有点无能。

if (!copy('http://maholi.com/image/data/Products/Linen - Juvenile and Infant/1440.jpg', $_SERVER['DOCUMENT_ROOT'].'/resources/categories/tttt6.jpg')) {
echo "failed";
}

有什么想法吗?

这对我来说很好用:

if (!copy('http://maholi.com/image/data/Products/Linen%20-%20Juvenile%20and%20Infant/1440.jpg', $_SERVER['DOCUMENT_ROOT'].'/tttt6.jpg')) {
  echo "failed";
}

编辑: URL不允许包含空格。参见“Is a URL allowed to contain a space?”。您的网络浏览器会自动对非法字符进行编码,让您相信它们是允许的。