if ($l[0] == null) { continue; } $data[] = $l; } $cons = '`id`,`itemGender`,`type`,`itemName`,`itemDate`'; $ln = null; foreach ($data as $k => $v) { $time = time(); array_walk($v, 'trim_arr'); $ln .= '(\''; $ln .= join($v, '\',\''); $ln .= '\',\'' . $time . '\'),'; } $ln = trim($ln, ",") . ';'; $im->iteminfo_import($cons, $ln); header('Location:' . $_SERVER['HTTP_REFERER']); } catch (Exception $e) { print $e->getMessage(); header('Location:' . $_SERVER['HTTP_REFERER']); } function trim_arr(&$value) { $value = trim($value); } function gender($gender) { switch ($gender) { case '妈': return 0; case '爸':