Home >php教程 >php手册 >PHP打开sqlite的两种方式

PHP打开sqlite的两种方式

WBOY
WBOYOriginal
2016-06-06 19:32:172308browse

PHP打开sqlite的两种方式(PDO和sqlite3) SQLite 源码与演示: 源码出处演示出处 ?php//直接启用sqlite3的方式/* $db = new SQLite3("data.dat");$results = $db-query('SELECT * FROM kuaidi');}*///使用PDO开启sqlite的方式//推荐$db = new PDO("sqlite:da

PHP打开sqlite的两种方式(PDO和sqlite3) SQLite

源码与演示:源码出处 演示出处

<?php

//直接启用sqlite3的方式
/* 
$db = new SQLite3("data.dat");
$results = $db->query('SELECT * FROM kuaidi');
}*/

//使用PDO开启sqlite的方式	//推荐
$db = new PDO("sqlite:data.dat");
$results = $db->query('SELECT * FROM kuaidi')->fetchAll();
foreach ($results as $key=>$row) {
	//var_dump($row);
	echo $row['id']." ".$row['code']." ".$row['company']."\n\r";
}
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn