Home >Backend Development >PHP Tutorial >Explanation of views in thinkPHP framework (with code)

Explanation of views in thinkPHP framework (with code)

不言
不言Original
2018-08-06 15:57:362347browse

This article introduces to you an explanation of views in the thinkPHP framework (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

thinkThere is a method in PHP that is similar to display(), fetch();

$this->display();display template

$this->fetch () Get the template (with return value)

There is a friendly printing method dump (variable to be printed) in TP

<?php
namespace Admin\Controller;
use Think\Controller;
class PublicController extends Controller{
public function login(){
//展示模板
//$this->display();
    //获取模板内容
    $str=$this->fetch();

    dump($str);
   // echo $str;//和display()一样

}
}

Recommended related articles:

thinkphp framework grouping: thinkphp obtains data that meets the conditions

How to hide the TP entry file under the Ubuntu system

The above is the detailed content of Explanation of views in thinkPHP framework (with code). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn