我有一个csv表单,我必须进行类别映射。我让这个csv从控制器读取。而且,我正在尝试建立一个层次结构。所以,我可以映射。但是,我无法做到这一点。请帮忙! [link:https://pricefalls.zendesk.com/hc/en-us/articles/204287645-How-do-I-create-a-category-map-“Pricefalls Category Taxonomy”]。我的csv与给定链接中显示的模式相同。
public function actionReadcsv()
{
$row = 1;
$csvFile = Yii::getAlias('@frontend') . '/modules/pricefalls /csv/Pricefalls_Categories1.csv';
if (($handle = fopen($csvFile, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, "|")) !== FALSE) {
$row++;
$create_category[] =$data;
}
Pricefallscategories::categorytree($create_category);
echo "<pre>";
print_r($create_category);
echo"</pre>";
fclose($handle);
}
}