导致问题原因可能是导出字段中包含有 ‘=’ ,解决办法:在字段前拼上一个半单引号。
if(strpos($lists[$i-2][‘nickname‘],‘=‘) === 0){ $lists[$i-2][‘nickname‘] = "‘".$lists[$i-2][‘nickname‘]; }
//csv的标题头 $headTitle = array( ‘开卡场馆‘, ‘卡号‘, ‘会员姓名‘, ‘开卡类型‘, ‘累计消费‘, ‘会员余额‘, ‘开卡时间‘, ‘操作员‘, ‘推荐人‘, ); //遍历写入每一行数据 foreach ($data[‘list‘] as $row) { // 将数据 严格 按照标题来排序 $have_order_row = array(); $have_order_row[] = $row["stadium_name"]; $have_order_row[] = $row["card_num"]; //$have_order_row[] = $row["member_name"]; $have_order_row[] = strpos($row["member_name"],‘=‘) === 0 ? "‘" . $row["member_name"] : $row["member_name"]; $have_order_row[] = $row["is_wxcard_str"]; $have_order_row[] = $row["consume_money"]; $have_order_row[] = $row["reality_money"]; $have_order_row[] = $row["time_str"]; $have_order_row[] = $row["operator_name"]; $have_order_row[] = $row["introducer_name"]; $bodyData[] = $have_order_row; }