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

PHP打开sqlite的两种方式

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:32:17
Original
2319 people have browsed it

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";
}
?>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template