search

Home  >  Q&A  >  body text

Imitate $this->show() in TP5 Controller

class Controller{ # Controller base class

public function show(){ # Load the view page

require "./App/".PLATFORM."/View/".CONTROLLER ."/".ACTION.".php";

}

}


RiVolRiVol2445 days ago1412

reply all(2)I'll reply

  • RiVol

    RiVol2018-03-07 00:29:34

    After using the above code, the Model layer data will become invalid, so I modified it:

    Put the following code into the Model:

    class Model{

    # Load the view page

    public function show(){

    return "./App/".PLATFORM."/View/".CONTROLLER."/".ACTION.". php";

    }

    }

    Call

    $ind = new IndexModel();

    require $ind->show();


    reply
    0
  • RiVol

    Welcome everyone to correct me

    RiVol · 2018-03-07 00:30:18
  • Cancelreply