php5.6 dbase,dBase数据库

dBase数据库是在个人电脑上使用的单机版数据库系统,dBase的系统包括核心数据库引擎、查询系统、表单引擎、与一个脚本编程语言。Unfortunately the dbase functions are not compiled into my commercial server's php and I needed to read some geo data in shape files, which include data in dbfs.

So maybe this will help some others:

function echo_dbf($dbfname) {

$fdbf = fopen($dbfname,'r');

$fields = array();

$buf = fread($fdbf,32);

$header=unpack( "VRecordCount/vFirstRecord/vRecordLength", substr($buf,4,8));

echo 'Header: '.json_encode($header).'

';

$goon = true;

$unpackString='';

while ($goon && !feof($fdbf)) { // read fields:

$buf = fread($fdbf,32);

if (substr($buf,0,1)==chr(13)) {$goon=false;} // end of field list

else {

$field=unpack( "a11fieldname/A1fieldtype/Voffset/Cfieldlen/Cfielddec", substr($buf,0,18));

echo 'Field: '.json_encode($field).'

';

$unpackString.="A$field[fieldlen]$field[fieldname]/";

array_push($fields, $field);}}

fseek($fdbf, $header['FirstRecord']+1); // move back to the start of the first record (after the field definitions)

for ($i=1; $i

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值