The process of page output in thinkphp is to read the template file, and then to parse the template (also support the invocation of Third-party template engine parsing), but there are some cases where we do not define the template file, or save the template file in the database, then when the page output, We were unable to read the template file, and the 3.1 version added the function of content parsing output. The built-in template engine is also perfected, and if the incoming template file does not exist, it is considered the incoming template parsing content, so 3.1 view classes and http://www.aliyun.com/zixun/aggregation/16339.html "> The action class has also made some improvements. The display method is used for template file render output, the Show method is used for the template content rendering output, and the Show method still supports the content parsing function, so we can use this in the controller:
$content = M (' Data ')->where ($map)->getfield (' content '); $this->show ($content);
For the contents of the $content variable, you can support the parsing of variables and tag libraries as well as template files, and you can also support template layout features. The Show method can also specify the output encoding and type, for example:
$this->show ($content, ' utf-8 ', ' by ');
In short, with the Show method, you can put the template in the database, the template management and update is also more convenient.
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.