search

Home  >  Q&A  >  body text

There are many problems with introducing constructors in th5

<?php

use app\common\controller\Base;

use app\common\validate\User;

use app\common\model\ User as UserModel;

class Test extends Base

{

public function test1(){

return $this-fetch ();

}

}

When the constructor is introduced, the template cannot be exported. Although it can be exported using the view function, many methods of the controller class cannot be used. , is there any good solution

黄耀彬W黄耀彬W2271 days ago1232

reply all(2)I'll reply

  • 风行者

    风行者2018-09-17 03:44:30

    I have never used tp.

    But remember to use parent::__construct() to inherit the parent class constructor for the subclass constructor

    reply
    0
  • Coco

    tp5+ is parent::_initialize(); don’t be scared to say it

    Coco · 2018-09-21 11:25:16
  • Cancelreply