输入banner图图片脚本导航/分类

fgetcsv取得的数组元素为空字符串时的解决方法

  1. // 上传的CSV文件,通常是用Excel编辑的GBK编码,

  2. // 而源代码是UTF-8,需要进行转码处理
  3. file_put_contents($new_file, iconv('GBK', 'UTF-8', file_get_contents($new_file)));

  4. //ini_set('auto_detect_line_endings', true);

  5. // 设置区域:简体中文,UTF-8编码
  6. setlocale(LC_ALL, 'zh_CN.UTF-8');
  7. // 打开CSV文件
  8. $handle = fopen($new_file, 'r');
  9. // 取出列头
  10. $data_heads = fgetcsv($handle);
  11. ?>