开发环境:

hadoop: hadoop-1.1.2

hbase: hbase-0.94.11-security

eclipse:Juno Service Release 2

配置Eclipse

通过 Eclipse 创建一个新 Java 工程,右击项目根目录,选择“Properties> Java Build Path> Library>  Add  External  JARs”,将 HBase 安装文件解压后根目录下的hbase-0.94.11-security.jar、hbase-0.94.11-security-tests.jar 和 lib 子目录下所有的 jar 包添加到本工程的 Build Path下。

示例一:输出表“users”的列族名称

import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.util.Bytes; public class ExampleClient {
public static void main(String[] args) throws IOException { Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "master");
conf.set("hbase.zookeeper.property.clientPort", "2181");
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor tableDescriptor = admin.getTableDescriptor(Bytes.toBytes("users"));
byte[] name = tableDescriptor.getName();
System.out.println("result:"); System.out.println("table name: "+ new String(name));
HColumnDescriptor[] columnFamilies = tableDescriptor
.getColumnFamilies();
for(HColumnDescriptor d : columnFamilies){
System.out.println("column Families: "+ d.getNameAsString());
}
}
}

结果:

2013-09-09 15:58:51,890 WARN  conf.Configuration (Configuration.java:<clinit>(195)) - DEPRECATED: hadoop-site.xml found in the classpath. Usage of hadoop-site.xml is deprecated. Instead use core-site.xml, mapred-site.xml and hdfs-site.xml to override properties of core-default.xml, mapred-default.xml and hdfs-default.xml respectively
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:host.name=w253245.ppp.asahi-net.or.jp
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.version=1.6.0_10-rc2
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.vendor=Sun Microsystems Inc.
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.home=C:\Java\jre6
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.class.path=D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\bin;D:\workspace\Eclipse-jee\hadoop-1.1.2\build\eclipse\classes-main;D:\workspace\Eclipse-jee\hadoop-1.1.2\build\eclipse\classes-test;D:\workspace\Eclipse-jee\hadoop-1.1.2\build\eclipse\classes-test-generated;D:\workspace\Eclipse-jee\hadoop-1.1.2\build\eclipse\classes-tools;D:\workspace\Eclipse-jee\hadoop-1.1.2\build\eclipse\classes-example;C:\apache-ant-1.9.2\lib\ant.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\asm-3.2.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\aspectjrt-1.6.11.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\aspectjtools-1.6.11.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-beanutils-1.7.0.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-beanutils-core-1.8.0.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-cli-1.2.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-codec-1.4.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-collections-3.2.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-configuration-1.6.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-daemon-1.0.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-digester-1.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-el-1.0.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-httpclient-3.0.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-io-2.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-lang-2.4.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-logging-1.1.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-logging-api-1.0.4.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-math-2.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\commons-net-3.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\core-3.1.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\hadoop-capacity-scheduler-1.1.2.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\hadoop-fairscheduler-1.1.2.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\hadoop-thriftfs-1.1.2.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\hsqldb-1.8.0.10.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jackson-core-asl-1.8.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jackson-mapper-asl-1.8.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jasper-compiler-5.5.12.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jasper-runtime-5.5.12.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jdeb-0.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jersey-core-1.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jersey-json-1.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jersey-server-1.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jets3t-0.6.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jetty-6.1.26.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jetty-util-6.1.26.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jsch-0.1.42.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jsp-2.1\jsp-2.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\jsp-2.1\jsp-api-2.1.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\junit-4.5.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\kfs-0.2.2.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\log4j-1.2.15.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\mockito-all-1.8.5.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\oro-2.0.8.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\servlet-api-2.5-20081211.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\slf4j-api-1.4.3.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\slf4j-log4j12-1.4.3.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\lib\xmlenc-0.52.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\src\test\lib\ftplet-api-1.0.0-SNAPSHOT.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\src\test\lib\ftpserver-core-1.0.0-SNAPSHOT.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\src\test\lib\ftpserver-server-1.0.0-SNAPSHOT.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\src\test\lib\mina-core-2.0.0-M2-20080407.124109-12.jar;D:\workspace\Eclipse-jee\hadoop-1.1.2\conf;D:\workspace\Eclipse-jee\hadoop-1.1.2\build\eclipse\test-resources;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\activation-1.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\asm-3.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\avro-1.5.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\avro-1.7.4.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\avro-ipc-1.5.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-beanutils-1.7.0.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-beanutils-core-1.8.0.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-cli-1.2.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-codec-1.4.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-collections-3.2.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-configuration-1.6.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-digester-1.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-el-1.0.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-httpclient-3.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-io-2.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-lang-2.5.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-logging-1.1.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-math-2.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\commons-net-1.4.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\core-3.1.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\guava-11.0.2.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\hadoop-common-0.23.9-javadoc.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\hamcrest-all-1.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\hamcrest-core-1.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\hbase-0.94.11-security.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\hbase-0.94.11-security-tests.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\high-scale-lib-1.1.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\httpclient-4.1.2.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\httpcore-4.1.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jackson-core-asl-1.8.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jackson-jaxrs-1.8.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jackson-mapper-asl-1.8.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jackson-xc-1.8.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jamon-runtime-2.3.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jasper-compiler-5.5.23.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jasper-runtime-5.5.23.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jaxb-api-2.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jaxb-impl-2.2.3-1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jersey-core-1.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jersey-json-1.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jersey-server-1.8.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jettison-1.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jetty-6.1.26.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jetty-util-6.1.26.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jruby-complete-1.6.5.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jsp-2.1-6.1.14.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jsp-api-2.1-6.1.14.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\jsr305-1.3.9.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\junit-4.10-HBASE-1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\libthrift-0.8.0.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\log4j-1.2.16.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\metrics-core-2.1.2.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\mrunit-1.0.0-hadoop2.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\mrunit-1.0.0-javadoc.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\netty-3.2.4.Final.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\protobuf-java-2.4.0a.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\servlet-api-2.5-6.1.14.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\slf4j-api-1.4.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\slf4j-log4j12-1.4.3.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\snappy-java-1.0.3.2.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\stax-api-1.0.1.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\velocity-1.7.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\xmlenc-0.52.jar;D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht\build\zookeeper-3.4.5.jar
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.library.path=D:\workspace\Eclipse-jee\hadoop-1.1.21\lib\native;D:\workspace\Eclipse-jee\hadoop-1.1.21\lib\native
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.io.tmpdir=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:java.compiler=<NA>
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:os.name=Windows XP
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:os.arch=x86
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:os.version=5.1
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:user.name=hadoop
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:user.home=C:\Documents and Settings\Administrator
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (Environment.java:logEnv(100)) - Client environment:user.dir=D:\workspace\Eclipse-jee\Hadoop_APPs_U_tht
2013-09-09 15:58:55,031 INFO zookeeper.ZooKeeper (ZooKeeper.java:<init>(438)) - Initiating client connection, connectString=master:2181 sessionTimeout=180000 watcher=hconnection
2013-09-09 15:58:56,171 INFO zookeeper.RecoverableZooKeeper (RecoverableZooKeeper.java:<init>(104)) - The identifier of this process is 6032@tht
2013-09-09 15:58:56,234 INFO zookeeper.ClientCnxn (ClientCnxn.java:logStartConnect(966)) - Opening socket connection to server master/121.1.253.251:2181. Will not attempt to authenticate using SASL (无法定位登录配置)
2013-09-09 15:58:56,296 INFO zookeeper.ClientCnxn (ClientCnxn.java:primeConnection(849)) - Socket connection established to master/121.1.253.251:2181, initiating session
2013-09-09 15:58:56,484 INFO zookeeper.ClientCnxn (ClientCnxn.java:onConnected(1207)) - Session establishment complete on server master/121.1.253.251:2181, sessionid = 0x141011ad7db000e, negotiated timeout = 180000
result:
table name: users
column Families: address
column Families: info
column Families: user_id

hbase:应用开发的更多相关文章

  1. HBase应用开发回顾与总结系列之四:HBase配置管理类接口设计

      利用Eclipse进行HBase应用开发时,至少需要确定三个配置信息,如下表所示: #hbase config #HMaster服务部署主机及端口号 hbase.master=hdp-wuyong ...

  2. HBase应用开发回顾与总结系列之一:概述HBase设计规范

      概述 笔者本人接触研究HBase也有半年之久了,虽说不上深入和系统,但至少算是比较沉迷.作为部门里大数据技术的探路者,笔者还要承担起技术传播的职责,所以在摸索研究的过程中总是不断地进行总结和测试, ...

  3. FusionInsight大数据开发--HBase应用开发

    HBase应用开发 HBase的定义 HBase是一个高可靠.高性能.面向列.可伸缩的分布式存储系统. 适合于存储大表数据,可以达到实时级别. 利用Hadoop HDFS 作为其文件存储系统,提供实时 ...

  4. HBase应用开发回顾与总结系列之三:RowKey行键生成器工具

      所谓RowKey行键生成器,是指通过软件工具制定行键生成策略,并可将策略信息保存成本地策略文件,待需要时再将本地策略文件序列化成行键生成策略对象,传入数据行信息后可自动生成RowKey行键. 那么 ...

  5. HBase应用开发回顾与总结系列之二:RowKey行键设计规范

    2. RowKey行键设计规范 2.1. RowKey四大特性 2.1.1 字符串类型 虽然行键在HBase中是以byte[]字节数组的形式存储的,但是建议在系统开发过程中将其数据类型设置为Strin ...

  6. HBase(一): c#访问hbase组件开发

    HDP2.4安装系列介绍了通过ambari创建hbase集群的过程,但工作中一直采用.net的技术路线,如何去访问基于Java搞的Hbase呢? Hbase提供基于Java的本地API访问,同时扩展了 ...

  7. HBase eclipse开发环境搭建

    伪分布式环境安装 事先本机必须部署好了伪分布式hadoop开发环境将Hbase/lib下的 hadoop-core-*.jar 与 hadoop保持一致. 将hadoop下的复制到hbase下将had ...

  8. hbase 快速开发

    hbase是一个分布式的NoSQL,部署起来配置很多东西,开发起来太慢,可以使用docker快速搭建环境 gs@gs-virtual-machine:~$ sudo docker run -ti ha ...

  9. 运行HBase应用开发程序产生异常,提示信息包含org.apache.hadoop.hbase.ipc.controller.ServerRpcControllerFactory的解决办法

    Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties Exception in thread ...

  10. HBase学习----windows10下使用eclipse搭建HBase的开发环境

    以下是我搭建HBase开发环境的一些心得(windows10) 0.安装JDK和eclipse和一个可用的HBase. 这步是最基础的,在此就不赘述了 1.创建一个java项目: 基础问题,不赘述. ...

随机推荐

  1. android -- 蓝牙 bluetooth (二) 打开蓝牙

    4.2的蓝牙打开流程这一部分还是有些变化的,从界面上看蓝牙开关就是设置settings里那个switch开关,widget开关当然也可以,起点不同而已,后续的流程是一样的.先来看systemServe ...

  2. (void)(&amp;x==&amp;y)

    #define max(x,y) ({ \ typeof(x) _x = (x);    \ typeof(y) _y = (y);    \ (void) (&_x == &_y); ...

  3. 判断圆和矩形是否相交C - Rectangle and Circle

    Description Given a rectangle and a circle in the coordinate system(two edges of the rectangle are p ...

  4. USACO March. 2012

    Connect the Cows Times17 水题 Landscaping Flowerpot Tractor 广搜 搜到边界就可以终止了 没什么难度 #include <stdio.h&g ...

  5. [转] Ant 编译 Android 项目为 Apk 实战, 常见问题解决

    补充,自行安装Ant, 配置ant环境变量, 在android 项目 根目录下使用 android update project 可以自动生成 build.xml 和 local.peoperties ...

  6. python几个排序函数 sort sorted argsort

    Python中排序常用到的sort .sorted和argsort函数 [摘要:Python中sort 战 sorted函数 一 .先容 sort函数是list列表中的函数,而 sorted能够对li ...

  7. ZOJ 2853 Evolution 【简单矩阵快速幂】

    这道题目第二次看的时候才彻底理解了是什么意思 把题目转化为数学模型分析后就是 有一个初始序列, 有一个进化率矩阵 求的是初始序列 与进化率矩阵进行 m 次运算后, 初始序列最后一位的答案 那么显然,可 ...

  8. 浏览器hack总结 详细的浏览器兼容性解决方法

    由于各浏览器对页面的解析不同,会导致页面在不同浏览器中显示的样式不一致,为了保持页面的统一,经常需要对浏览器进行兼容性问题的调试. CSS Hack 面对浏览器诸多的兼容性问题,经常需要通过CSS样式 ...

  9. Android 四种启动模式 已看晕

    http://blog.csdn.net/zdw890412/article/details/7386314  //有点乱 http://www.cnblogs.com/fanchangfa/arch ...

  10. php 写内容入csv文件乱码解决方法

    加入BOM头即可 fwrite($fp,"\xEF\xBB\xBF"); 参考:http://justcoding.iteye.com/blog/1668308