This article mainly introduces the use of the PDO connection Sqlite3 configuration method, combined with the case form a more detailed analysis of PHP based on PDO operation Sqlite3 related considerations, the need for friends can refer to the following
Just started using Php+sqlite, always think that they use sqlite3, actually not, PHP php5 >=5.3.0 from the time to start the default support Sqlite3
Refer to Official Document http://www.php.net/manual/zh/sqlite3.open.php
The default method interface:
public void Sqlite3::open (string $filename [, int $flags = Sqlite3_open_readwrite | Sqlite3_open_create [, String $encryption _key]])
Using PHP to operate the database found that PHP is only supported by default to Sqlite2, the latest version of the Sqlite3 is not supported. If you want to support Sqlite3 you will use PDO. To use PDO, you need to load the Php_pdo.dll and Php_pdo_sqlite.dll two modules into the php.ini. As follows:
Extension=php_pdo.dllextension=php_pdo_sqlite.dll
If you do not use PDO, even if you open the above parameters, in fact, still use sqlite2, do not believe you access to see the generated database at the beginning of the file is not a hint:
* * This file contains an SQLite 2.1 database * *
The following error is reported when the PHP environment does not open the configuration supported above:
Fatal error:call to undefined function sqlite_open ()
sqlite3 Example:
Verify: View database:
In the file header display:
SQLite format 3***
Summary: The above is the entire content of this article, I hope to be able to help you learn.