为了账号安全,请及时绑定邮箱和手机立即绑定

Non-static method think\DbManager::connect() should not be called statically

namespace app\controller;use app\BaseController;use think\Db;class Index extends BaseController {	public function index($name = 'Keith', $age = 28) {	// return 'hello ' . $name . ' I\'m ' . $age;		// dump(config("database"));		try {			$res = Db::connect();			// $res = [];			dump($res);		} catch (Exception $e) {			dump($e);			echo "异常了";		}	}	public function hello($name = 'ThinkPHP6') {		return 'hello,' . $name;	}}


正在回答

1 回答

作者使用的是5.0的,我使用的是6.0,在6.0下,ues think\facade\Db; 这样就ok了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
快速入门ThinkPHP 5.0 --模型篇
  • 参与学习       27046    人
  • 解答问题       100    个

Thinkphp5.0已发布多时,想了解thinkphp 5.0的新特性吗?老司机点准时出发

进入课程

Non-static method think\DbManager::connect() should not be called statically

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信