问题描述:数据库中有张TP_table的数据表,在thinkphp6 model中使用$table也设置了表名为TP_table,还是报错SQLSTATE[42P01]: Undefined table: 7 错误: 关系 “tp_table” 不存在…
// 解决方法在$table中设置表名时加上""
<?php
namespace app\model;
use think\Model;
class TPTable extends Model {
protected $table = '"TP_table"';
protected $connection = 'mysql_2';
protected $pk = 'id';
protected $schema = [
'id' => 'int',
];
}