PHPEXCEL导出,存在特殊字符遇到的问题

    [13] => Array
        (
            [payment_success_at] => 
            [user_name] => ?.琳琳?
            [remarks] => 
            [product_name] => 香菇
            [sku_name] => 斤
            [product_property] => 斤
            [price_original] => 5.50
            [price_current] => 5.50
            [consignee] => ?.琳琳?
        )

以上代码中用户名中存在特殊符号,导致phpexcel导出时无法识别,会出现部分字段数据丢失的问题.

以下处理:

iconv('gb2312//ignore', 'utf-8', iconv('utf-8', 'gb2312//ignore', $value['consignee']));

处理后:

    [13] => Array
        (
            [user_name] => .琳琳
            [remarks] => 
            [product_name] => 香菇
            [sku_name] => 斤
            [product_property] => 斤
            [price_original] => 5.50
            [price_current] => 5.50
            [product_quantity] => 2
            [consignee] => .琳琳
        )

就可以正常导出了.

你可能感兴趣的:(记录)