Home >Backend Development >PHP Tutorial >Explanation of views in thinkPHP framework (with code)
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!