1
Я пытаюсь загрузить объемные данные, используя загрузка CSV upload.File сделана отлично, но выборки данных формы CSV терпит неудачу и показывает ошибку нижеCsv upolading неудачу в CodeIgniter
array_map() ожидает параметр 1, чтобы быть действительным обратным вызовом , класс '100' не найден Это мой код в мой контроллер
if (isset($_FILES["userfile"]))
{
$this->load->library('upload_photo');
//Set the config
$config['upload_path'] = 'assets/uploads/csv/';
$config['allowed_types'] = 'csv';
$config['max_size'] = '200';
$config['overwrite'] = TRUE;
$this->upload_photo->initialize($config);
if(! $this->upload_photo->do_upload())
{
$error = $this->upload_photo->display_errors();
}
//If the upload success
$csv = $this->upload_photo->file_name;
$arrResult = array();
$handle = fopen("assets/uploads/csv/".$csv, "r");
if($handle)
{
while (($row = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$arrResult[] = $row;
}
fclose($handle);
}
$titles = array_shift($arrResult);
$keys = array('id', 'name', 'city','state');
$final = array();
foreach ($arrResult as $key => $value)
{
$final[] = array_combine($keys, $value);
}
$rw=2;
foreach($final as $csv_em)
{
$rw++;
$id[] = $csv_em['id'];
$name[] = $csv_em['name'];
$city[] = $csv_em['city'];
$state[] = $csv_em['state'];
}
}
$ikeys = array('id', 'name', 'city','state');
$items = array();
foreach (array_map($id, $name, $city, $state) as $ikey => $value)
{
$items[] = array_combine($ikeys, $value);
}
$this->employee_model->insertByCSV($items);