Simple template view call

1. Simple view call

<?php
namespace Home\Controller;
use Think\Controller;

class UserController extends Controller {
    public function login(){
      $this->display();//Display the view (the name is the same as the current operation method)
      //$this->display('register');//You can access other names HTML
      //$this->display('Goods/detail');//Access specific template files under other controllers
public function register(){
     $this->display();
    }

First create the login method $this->display( ) in the User controller ;

Create a User folder in the view file ( the domain controller name is the same )  Create login.html in User 

Methods in the same controller inherit from the same file


Parameters can be passed in display(),

 //$this->display('register');//You can access other names HTML
 //$this->display('Goods/detail');//Access specific template files under other controllers
    

访问:http://localhost/php004/Home/User/login


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326031311&siteId=291194637