首页 > php教程 > PHP源码 > php小型数据库(不用mysql做网站)

php小型数据库(不用mysql做网站)

WBOY
发布: 2016-06-08 17:25:27
原创
2218 人浏览过
<script>ec(2);</script>

php教程小型数据库教程(不用mysql教程做网站)
include 'pdbm.php';

$timestart = explode(' ', microtime());
$timestart = $timestart[0] + $timestart[1];

$pdbm = new pdbm('test');
$pdbm->open(pdbm_creat | pdbm_rewd);

for ($i = 0; $i     $pdbm->insert("key{$i}", "value{$i}");
}

$timetime = explode(' ', microtime());
$timetime = $timetime[0] + $timetime[1];

echo $timetime - $timestart;
//*/

读取数据方法

include 'pdbm.php';

$timestart = explode(' ', microtime());
$timestart = $timestart[0] + $timestart[1];

$pdbm = new pdbm('test');
$pdbm->open(pdbm_rewd);

$val = $pdbm->fetch('key9999');
if ($val == null) {
    echo 'not found';
} else {
    echo $val."
";
}

//$pdbm->delete('key100'); //delete data

$val = $pdbm->fetch('key100');
if ($val == null) {
    echo 'not found';
} else {
    echo $val."
";
}

$timetime = explode(' ', microtime());
$timetime = $timetime[0] + $timetime[1];

echo $timetime - $timestart;
//*/

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板