Php 使用str_replace获取csv magento的所有图像

Php 使用str_replace获取csv magento的所有图像,php,string,magento,csv,Php,String,Magento,Csv,大家好,我有一个csv的我的供应商与此格式 urlmagexx.jpg、urlmageyyy.jpg、urlmagezzz.jpg 在我直接导入Magento的脚本中,我有以下代码 $fullpath = '/tmp/'.basename($rfullpath); // $rfullpath = str_replace(',','%20', $rfullpath); // $rfullpath = rtrim($rfullpath, '%20');

大家好,我有一个csv的我的供应商与此格式

urlmagexx.jpg、urlmageyyy.jpg、urlmagezzz.jpg

在我直接导入Magento的脚本中,我有以下代码

$fullpath = '/tmp/'.basename($rfullpath);

       // $rfullpath = str_replace(',','%20', $rfullpath);
       // $rfullpath = rtrim($rfullpath, '%20');
        $rfullpath = str_replace(' ', '%20', $rfullpath);
        $rfullpath = rtrim($rfullpath, '%20');



        $rimagen = file_get_contents($rfullpath);
        file_put_contents($fullpath, $rimagen)
我试过使用注释代码,但不起作用。 你能帮我吗

其他例子 一个例子

我的脚本有以下代码

  for($i=11; $i>=11; $i--)
    {
        $rfullpath = $csv[$i];

        if(!substr_count($rfullpath, 'http')) continue;

        $fullpath = '/tmp/'.basename($rfullpath);

       // $rfullpath = str_replace(',','%20', $rfullpath);
       // $rfullpath = rtrim($rfullpath, '%20');
        $rfullpath = preg_replace('%\,/%','%20', $rfullpath);
        $rfullpath = rtrim($rfullpath, '%20');


        $product->setImage_label($data['name']); //para titulo imagenes  (prueba) //para las imagenes titulos
        $rimagen = file_get_contents($rfullpath);
        file_put_contents($fullpath, $rimagen);

        try {
            $product->addImageToMediaGallery($fullpath ,array('image', 'small_image', 'thumbnail') , false, false);
        } catch (Exception $e) {
            //echo " FAIL imagen $i $rfullpath\n";
            file_put_contents('fallos.txt', $data['sku']." imagen $i $rfullpath\n", FILE_APPEND | LOCK_EX);

但不起作用,如果仅上传一个url的图像就起作用,则产品图像将出现404错误。

请指定
不起作用。
。你没有得到想要的结果?出现错误?仅放置1个图像,其他图像不会导入到产品中。没有错误仅不会上载到第二个或第三个图像