The example in this article describes the configuration method that PHP uses for PDO connection sqlite3. Share to everyone for your reference, specific as follows:
Just start using php+sqlite, always thought oneself use is sqlite3, actually is not, PHP starts from PHP5 >=5.3.0 when the default support Sqlite3
Reference to official documents http://www.php.net/manual/zh/sqlite3.open.php
Default method Interface:
public void Sqlite3::open (string $filename [, int $flags = Sqlite3_open_readwrite | Sqlite3_open_create [, String $encryption _key]])
Using PHP to manipulate the database found that PHP is only supported to Sqlite2 by default and does not support the latest version of Sqlite3. If you want to support Sqlite3, you need to use PDO. To use PDO, you need to load the Php_pdo.dll and Php_pdo_sqlite.dll two modules inside the php.ini. As follows:
Extension=php_pdo.dll
Extension=php_pdo_sqlite.dll
If you do not use PDO, even if you open the above parameters, in fact, or use Sqlite2, do not believe you access to see the generated database at the beginning of the file is not prompted:
* * This file contains a 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:
Display in file header:
SQLite format 3***
More explanation can refer to official website: http://cn.php.net/manual/zh/ref.pdo-sqlite.php
More about PHP Interested readers can view the site topics: "PHP based on PDO Operation Database Skills Summary", "Php+oracle Database Programming Skills Summary", "PHP+MONGODB Database Operation Skills Encyclopedia", "PHP object-oriented Programming Program", Summary of PHP string usage, Getting Started tutorial on Php+mysql database operations, and summary of common PHP database operations techniques
I hope this article will help you with the PHP program design.