Export ra CSV file với Unicode
lượt xem 3
download
Bài toán: export dữ liệu tiếng Việt UTF-8 thành file CSV có thể hiển thị đúng khi mở bằng Excel. 3 điểm dẫn đến thành công: + Dùng TAB (\t) thay cho COMMA (,) để phân tách các cột + Convert Encoding của dữ liệu cần output bằng UTF-16LE + Gắn chr(255)chr(254) vào đầu của kết quả cuối cùng trước khi output /** * EXPORT ORDER LIST TO CSV FILE * @author khanhdn */ function exportCSV() { global $user; member_access(); $memberInfo = member_info(); $result = drupal_query("SELECT order_id ,order_code ,bill_firstname ,bill_lastname ,order_modify_date ,gand_total ,order_status FROM {order} WHERE shop_code = '".$memberInfo['shop_code']."' ORDER BY...
Bình luận(0) Đăng nhập để gửi bình luận!
CÓ THỂ BẠN MUỐN DOWNLOAD