PHP_PDO 简介

Posted on 2008-07-25 00:45 飞呀飞 阅读(859) 评论(0)  编辑 收藏 引用 网摘 所属分类: php
php5原来内建的sqlite扩展只支持sqlite2,对sqlite3的支持可以用多种方法实现,我觉得最方便的还是pdo,只需在安装配置php 时,设置pdo_sqlite扩展,不需要安装其他的东西。当然功能能也许不及专门的sqlite3扩展。根据官方文档逐渐翻译学习!
http://cn2.php.net/manual/en/intro.pdo.php

PHP Data Objects (PDO)扩展是PHP中一个轻量级的、统一的数据接口。每种数据库依靠特定的正则函数驱动PDO接口,能反映出数据库特征。注意:你不能单独仅依靠PDO扩展来访问任何数据库;你必须使用特定数据库PDO驱动来访问数据库服务器。

PDO提供一个数据访问层,意思是,不管你使用那种数据库,都可以用同样的函数执行查询和获取结果。PDO不提供数据库抽象,如果你需要该功能应该使用成熟的抽象。

PDO是在PHP5.1 中引入,也可以作为PHP5.0的PECL扩展;PDO需要PHP5核心中的新的面现对象特征,所以不能在以前的版本中运行。

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

PDO ships with PHP 5.1, and is available as a PECL extension for PHP 5.0; PDO requires the new OO features in the core of PHP 5, and so will not run with earlier versions of PHP.

只有注册用户登录后才能发表评论。
网站导航:

Copyright © 飞呀飞