如:

读取后:

里面的unit(招录单位)只有第一行读入了,其他都为空。
下面是我的核心代码:
$objContent = $objReader -> load($file['tmp_name']);
if ($objContent){
//读取第一个sheet
$sheetContent = $objContent -> getSheet(0) -> toArray();
//删除第一行标题
unset($sheetContent[0]);
//$time= $mothtime= strtotime(date("Y-m-d H:i:s", strtotime("-1 month")));
foreach ($sheetContent as $k => $v){
$arr['unit'] = $v[0];
$arr['station'] = $v[1];
$arr['id'] = $v[2];
$arr['need_num'] = $v[3];
$arr['major'] = $v[4];
$arr['education_background'] = $v[5];
$arr['political'] = $v[6];
$arr['other'] = $v[7];
$res[] = $arr;
}
$re=db('position')->insertAll($res);
感谢大家不吝赐教! 最佳答案
