fputcsv display leading zeros

后端 未结 4 2094
轮回少年
轮回少年 2021-01-04 17:57

I\'m using a php script to generate an excel CSV file from a result-set query. All works fine but when i read my excel file, I can not display leading zeros.

this is

4条回答
  •  灰色年华
    2021-01-04 18:21

    To add to DemoUser's approach:

    The \t approach worked for me however with a slight change

    $column_data = "\t000543";
    

    Adding the \t solved my problem of having the leading zero's disappear, even though the CSV was correct and Excel was 'wrong' the \t worked in keeping the leading zeros intact when displaying in excel.

提交回复
热议问题