1. 程式人生 > >exception ‘PHPExcel_Calculation_Exception‘ with message ‘粉絲數據!C2679 -> Formula Error: Operator ‘=‘ has no operands

exception ‘PHPExcel_Calculation_Exception‘ with message ‘粉絲數據!C2679 -> Formula Error: Operator ‘=‘ has no operands

排序 操作員 reac nic sta rod tor post gpo

導致問題原因可能是導出字段中包含有 ‘=’ ,解決辦法:在字段前拼上一個半單引號。

 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;
                        }

exception ‘PHPExcel_Calculation_Exception‘ with message ‘粉絲數據!C2679 -> Formula Error: Operator ‘=‘ has no operands