我有prestashop。使用 IMPORTOSC 模块导入数据。
一切都很好,只发出其中有空格的图像,其名称未导入到 prestashop。(URL 中的空格)
类别导入代码:
public function getCategories($limit = 0, $nrb_import = 100) {
$multiLangFields = array('name', 'link_rewrite');
$keyLanguage = 'id_lang';
$identifier = 'id_category';
$categories = $this->ExecuteS('
SELECT c.categories_id as id_category, c.parent_id as id_parent, 0 as level_depth, cd.language_id as id_lang, cd.categories_name as name , 1 as active, categories_image as images
FROM `'.bqSQL($this->prefix).'categories` c
LEFT JOIN `'.bqSQL($this->prefix).'categories_description` cd ON (c.categories_id = cd.categories_id)
WHERE cd.categories_name IS NOT NULL AND cd.language_id IS NOT NULL
ORDER BY c.categories_id, cd.language_id
LIMIT '.(int)($limit).' , '.(int)$nrb_import);
foreach($categories as& $cat)
{
$cat['link_rewrite'] = Tools::link_rewrite($cat['name']);
$cat['images'] = array(Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$cat['images']);
}
return $this->autoFormat($categories, $identifier, $keyLanguage, $multiLangFields);
}
我搜索了一下,它看起来像 str_replace(' ', '%20', trim($url))
有人可以帮我写代码。