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

Explanation of views in thinkPHP framework (with code)

不言
Release: 2023-04-03 16:54:01
Original
2350 people have browsed it

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()一样

}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template