Thinkphp5.0框架中如何实现数据库连接与增删改查操作?
- 内容介绍
- 文章标签
- 相关推荐
本文共计1015个文字,预计阅读时间需要5分钟。
本例介绍了Thinkphp5.0框架的数据库操作。以下是一个简单的示例:
phpnamespace app\index\controller;use think\Controller;use think\Db;
class Index extends Controller{ public function study_db() { // 连接操作 Db::connect('mysql://root:password@localhost/db_name'); }}
本文实例讲述了Thinkphp5.0框架的Db操作。
本文共计1015个文字,预计阅读时间需要5分钟。
本例介绍了Thinkphp5.0框架的数据库操作。以下是一个简单的示例:
phpnamespace app\index\controller;use think\Controller;use think\Db;
class Index extends Controller{ public function study_db() { // 连接操作 Db::connect('mysql://root:password@localhost/db_name'); }}
本文实例讲述了Thinkphp5.0框架的Db操作。

