<?php
require_once './vendor/autoload.php';
use think\Db;
$dbconf = [
'type' => 'mysql',
'hostname' => '127.0.0.1',
'database' => 'job_nad',
'username' => 'root',
'password' => 'root',
'hostport' => '3306',
'params' => [],
'charset' => 'utf8mb4',
'prefix' => 'tb_',
];
Db::setConfig($dbconf);
$data = Db::table('user')->find();
var_dump($data);
报错信息
PS D:\developer\job.app\nad-test> php 1.php
PHP Fatal error: Uncaught exception 'think\db\exception\PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'job_nad.user' doesn't exist' in D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Connection.php:670
Stack trace:
#0 D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\connector\Mysql.php(90): think\db\Connection->query('SHOW COLUMNS FR...', Array, false, true)
#1 D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Connection.php(376): think\db\connector\Mysql->getFields('user')
#2 D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Connection.php(412): think\db\Connection->getTableInfo('user', 'pk')
#3 D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Query.php(1912): think\db\Connection->getPk('user')
#4 D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Connection.php(777): think\db\Query->getPk(Array)
#5 D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Query.php(2453): think\db\Connection->find(Ob in D:\developer\job.app\nad-test\vendor\topthink\think-orm\src\db\Connection.php on line 670