我正在PrestaShop中制作一个模块,我想在安装模块时将php中的映像从一个位置复制到另一个位置。在模块中,我做了
public function install()
{
include(dirname(__FILE__).'/install.php');
在install.php中,我尝试过:
copy("./folder1/image.jpg","../../folder2/folder3/image.jpg");
还有
Tools:copy("./folder1/image.jpg","../../folder2/folder3/image.jpg");
不起作用。
答案 0 :(得分:0)
找到了答案。需要在主模块php中做到这一点
public function CopyImages()
{
Tools::Copy (_PS_MODULE_DIR_ .'mymodlue/views/img/image1.jpg',_PS_MODULE_DIR_ .'modulefolder/folder1/folder2/image1.jpg');
}
然后输入:
public function install()
{
$this->CopyImages();