thinkphp3.2.3 cannot load the database driver: Think\Db\Driver\
迷茫
迷茫 2017-05-16 13:12:01
0
3
1393

This is my code in Common conf config.php

return array(

 //'Configuration item'=>'Configuration value'
 $options = array(
     //Database configuration
     'DB_TYPE' => 'mysql', // Database type
     'DB_HOST' => 'localhost', // Server address
     'DB_NAME' => 'xueji', // database name
     'DB_USER' => 'root', // username
     'DB_PWD' => '', // Password
     'DB_PORT' => '3306', // Port
     'DB_PREFIX' => 'xueji_', // Database table prefix
 ),

);

This is my local database

What's the problem? I keep getting errors and I don't know where the problem is
:(
Unable to load database driver: ThinkDbDriver\
Error location
FILE:
/Applications/MAMP/htdocs /xuexi/test/ThinkPHP/Library/Think/Db.class.php LINE: 42
TRACE

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/Db.class.php(42): E('xE6x97xA0xE6xB3x95xE5x8AxA0xE8xBDxBDxE6x95xB0...')

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/Model.class.php(1443): ThinkDb::getInstance('')

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/Model.class.php(97): ThinkModel->db(0, '', true)

/Applications/MAMP/htdocs/xuexi/test/Application/Home/Controller/IndexController.class.php(15): ThinkModel->__construct()

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/App.class.php(173): ReflectionMethod->invoke(Object(HomeControllerIndexController))

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/App.class.php(110): ThinkApp::invokeAction(Object(HomeControllerIndexController), 'index')

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/App.class.php(204): ThinkApp::exec()

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/Library/Think/Think.class.php(120): ThinkApp::run()

/Applications/MAMP/htdocs/xuexi/test/ThinkPHP/ThinkPHP.php(97): ThinkThink::start()

/Applications/MAMP/htdocs/xuexi/test/index.php(25): require('/Applications/M...')

{main}

Everyone, I have solved the problem. Let me tell you. I used C('DB_TYPE') and it was empty. If I look at the above format, the return should be a one-dimensional data and I returned a two-dimensional data
So Change to
return

 //'Configuration item'=>'Configuration value'
 $options = array(
     //Database configuration
     'DB_TYPE' => 'mysql', // Database type
     'DB_HOST' => 'localhost', // Server address
     'DB_NAME' => 'xueji', // database name
     'DB_USER' => 'root', // username
     'DB_PWD' => 'root', // Password
     'DB_PORT' => '3306', // Port
     'DB_PREFIX' => 'xueji_', // Database table prefix

);

That’s it

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
洪涛

You are trying it insideCommon目录下的conf目录下的config.php进行数据库的配置的?还是说是在Home(你自己的应用目录)目录下的conf目录下的config.php
如果是后者,请把数据库的配置更改到Common目录下的conf目录下的config.php

世界只因有你

Why doesn’t the questioner post the complete error message? I can’t guess what’s causing this

巴扎黑

Try localhost改成127.0.0.1;

If you use Mac, remember to give read and write permissions to all files in the project folder. You can execute it in the project root directory:
sudo chmod -R 777 *

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template