ThinkPHP5 Introducing Templates

Source: Internet
Author: User

There are three ways to do this:
First: direct use of return view (); Helper functions
The second kind: use think\view; Class Admin extends view see below
The Third Kind: use think\controller; Class Admin extends Controller return $this->>fetch ();
<?php
namespace App\admin\controller;
Use Think\view; The second Kind
Use Think\controller; Third Kind
Class Admin extends View
{
Public Function LST ()
{
The first method loads the template using the helper function to configure the template suffix in config is the simplest
return view ();
The second method loads the template, you need to specify the suffix format config invalid use Think\view extends View
$view =new View ([' view_suffix ' = ' htm ',]);
return $view->fetch ();
The third kind of use Think\controller; Configure the template suffix extends Controller in config
return $this->>fetch ();
}
}

ThinkPHP5 Introducing Templates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.