This article describes the simple implementation method of thinkPHP to connect to sqlite3 database. Share it with everyone for your reference, the details are as follows:
First check if there is a DbPdo.class.php file in the LibDriverDb directory under the Thinkphp directory.
If not, go here to download it: http://www.thinkphp.cn/extend/205.html
Then confirm that PHP's extended support for sqlite is turned on, extension=php_sqlite.dll
Connect to sqlite3 database:
Add the following configuration in the config.php file:
'DB_TYPE' => 'pdo', 'DB_DSN' => 'sqlite:DataBase/db.db', 'DB_PREFIX' => 'fish_', // 数据库表前缀 'DB_CHARSET' => 'utf8', // 数据库编码默认采用utf8 'DB_FIELDS_CACHE' => false, // 启用字段缓存
Attachment: Click here for Thinkphp code generatorDownload from this site.
Directly generate front-end and back-end CRUD code snippets, and you can also customize code templates as needed to reduce duplication of work. Supports MySQL and sqlite databases to quickly build project prototypes.
PS: Here are several formatting/beautifying/conversion tools recommended on this site to help you sort out the messy code. I believe everyone can use it in future development:
php code online formatting and beautification tool:
http://tools.jb51.net/code/phpformat
Online XML/JSON conversion tool:
http://tools.jb51.net/code/xmljson
JSON code online formatting/beautifying/compressing/editing/conversion tool:
http://tools.jb51.net/code/jsoncodeformat
SQL code online formatting and beautification tool:
http://tools.jb51.net/code/sqlcodeformat
Readers who are interested in more thinkPHP-related content can check out the special topics on this site: "Introduction to ThinkPHP Tutorial", "Summary of Common Methods of ThinkPHP", "Summary of Cookie Usage in PHP", "Basic Tutorial for Getting Started with Smarty Templates" and "PHP Template technology summary".
I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.