首頁  >  問答  >  主體

繼承Controller類別後報錯

<?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);

}

}

會顯示網頁無法運作,去掉extends Controller就不會報這個錯誤

22221119 天前1531

全部回覆(5)我來回復

  • autoload

    autoload2021-09-02 16:35:55

    你是tp6還是5,tp6繼承BaseController

    回覆
    0
  • 22

    tp5,我找到原因了,沒有從入口文件訪問

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

    222021-08-31 09:27:19

    截屏2021-08-31 09.25.41.png報的這個錯,而且我已經把調試模式打開了

    截屏2021-08-31 09.26.25.png

    #

    回覆
    0
  • autoload

    autoload2021-08-31 09:19:24

    會報什麼不好?截圖來看看啊

    回覆
    0
  • 22

    我發在下面了 您看看

    22 · 2021-08-31 09:27:35
  • 取消回覆