This article describes an example of ThinkPHP’s method of preventing ../Public from being parsed in the template. . Share it with everyone for your reference. The details are as follows:
Question:
The template contains ../Public and needs to be output directly, but ../Public will be directly replaced by the current public template directory, and the final output is: /Project Directory/Tpl/default/Public/
Solution:
Add template constant settings in the configuration file config.php:
'TMPL_PARSE_STRING' => array( '../Public' =>"../Public", ) // 模板引擎要自动替换的字符串,必须是数组形式。
Here you can set ../Public to output as is.
I hope this article will be helpful to everyone’s ThinkPHP programming design.