本文实例讲述了Thinkphp5.0框架的Db操作。分享给大家供大家参考,具体如下:
连接操作:
<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
class Index extends Controller
{
public function study_db(){
//方式一:默认读取配置文件的配置
$res = Db::connect();
//方式二:手动
1.问题描述: 我桌面上有一个“账号密码.db”文件,我现在想知道里面有几张表格table、表格的名字、表头结构。
2.使用SQL语句”””select name from sqlite_master where type=’table’ order by name”””,查找表格的名字。实例代码如下:
# coding:utf-8
import sqlite3
conn = sqlite3.connect(C:\\Users\\Administrator\\Desktop\\密码账号.db)