search

Home  >  Q&A  >  body text

Error reported after inheriting Controller class

<?php

namespace app\admins\controller;

use think\Controller;

use Util\data\Sysdb;

class Test extends Controller

{

public function index(){

$this->db = new Sysdb ;

$res = $this->db->table('admins')->field('id,username')->lists();

dump ($res);

}

}

will show that the web page cannot operate. If you remove the extends Controller, this error will not be reported

22221171 days ago1579

reply all(5)I'll reply

  • autoload

    autoload2021-09-02 16:35:55

    Are you tp6 or 5? tp6 inherits BaseController

    reply
    0
  • 22

    tp5, I found the reason, there is no access from the entry file

    22 · 2021-09-02 16:36:40
  • 22

    222021-08-31 09:27:19

    截屏2021-08-31 09.25.41.pngI reported this error, and I have turned on the debug mode

    截屏2021-08-31 09.26.25.png

    reply
    0
  • autoload

    autoload2021-08-31 09:19:24

    What error will be reported? Let’s take a look at the screenshots

    reply
    0
  • 22

    I posted it below. Take a look.

    22 · 2021-08-31 09:27:35
  • Cancelreply