如何使用importcsv插件读取CSV文件数据

i want to read data from CSV file ( which is stored in my web directory ) using YII y , after searching i came across importcsv extension.

i have tried setting modules and path , but now i don't know how to use this importcsv extension , i didn't get any example over net too , just to read data from CSV and then store it in mysql database.

here is my config.php

 'importcsv'=>array(
            'path'=>'assets/importCsv/', // path to folder for saving csv file and file with import params
        ),
  1. in your yii application -> in protected folder you need to create modules folder;
  2. create importcsv folder in modules folder;
  3. extract the github extension code ("yii-importcsv-extension-master->importcsv") in importcsv root folder (is important to have the same name of the folder with the name of the module set in config). You need to have one folder named importcsv in modules folder containing all the code ("views folder, controller folder, models folder...etc.");
  4. in config->main.php you need to set in modules

    'importcsv'=>array( 'path'=>'assets/importCsv/', // path to folder for saving csv file and file with import params ),

Very important !!! The module need to be extracted in protected/modules folder not in protected/extensions folder and the name writhed in config/main.php -> modules need to be exactly the same on the folder extracted in modules.

  1. Access the module with the same name writhed in config:

    http://www.host.com/yourproject/importcsv.

    Or here:

    http://www.host.com/yourproject/index.php?r=importcsv.