亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php - Problem with creating new model in tp3.2
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-06-29 10:08:42
0
4
964

RegistorController.class.php and RegistorModel.class.php under user module

RegistorController.class.php code

namespace User\Controller;
use Think\Controller;
use User\Model\RegistorModel;

class RegistorController extends Controller
{

    public function test(){
        new RegistorModel();
//        D('Registor');
    }
}

RegistorModel.class.php

namespace User\Model;
use Think\Model;

class RegistorModel extends Model
{

}

When accessing the address test() method, it prompts that the database driver cannot be loaded: ThinkDbDriver\
Just a few lines of code, and I re-downloaded the tp and core code all morning. I have excluded everything that can be eliminated. I’m so depressed
tp’s detailed error message

無法加載數(shù)據(jù)庫驅(qū)動: Think\Db\Driver\
錯誤位置
FILE: D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\Db.class.php  LINE: 42
TRACE
#0 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\Db.class.php(42): E('\xE6\x97\xA0\xE6\xB3\x95\xE5\x8A\xA0\xE8\xBD\xBD\xE6\x95\xB0...')
#1 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\Model.class.php(1443): Think\Db::getInstance('')
#2 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\Model.class.php(97): Think\Model->db(0, '', true)
#3 D:\www\oschina\Addons_Project\Addons\Application\User\Controller\RegistorController.class.php(16): Think\Model->__construct()
#4 [internal function]: User\Controller\RegistorController->test()
#5 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\App.class.php(173): ReflectionMethod->invoke(Object(User\Controller\RegistorController))
#6 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\App.class.php(110): Think\App::invokeAction(Object(User\Controller\RegistorController), 'test')
#7 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\App.class.php(204): Think\App::exec()
#8 D:\www\oschina\Addons_Project\Common\ThinkPHP\Library\Think\Think.class.php(120): Think\App::run()
#9 D:\www\oschina\Addons_Project\Common\ThinkPHP\ThinkPHP.php(97): Think\Think::start()
#10 D:\www\oschina\Addons_Project\Addons\index.php(28): require('D:\www\oschina\...')
#11 {main}
PHP中文網(wǎng)
PHP中文網(wǎng)

認證0級講師

reply all(4)
學霸

$registor= D('Registor');
config.php in the conf directory. You should configure the database in the config.php in the conf directory in the Common directory, not the config in the conf directory in the Home directory. .php.

女神的閨蜜愛上我

Look at the configuration file DB_TYPE which should be mysql

某草草

Check whether the database configuration is correct and use D("Registor") to instantiate the custom model

洪濤

With many years of experience as an experienced driver, the first floor is the correct answer, and the others are wrong.

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