Home > PHP Framework > ThinkPHP > What should I do if thinkphp does not parse u?

What should I do if thinkphp does not parse u?

藏色散人
Release: 2021-12-21 11:31:14
Original
2174 people have browsed it

thinkphp does not parse u because the template engine will only parse it once, and tag usage that is not in the template file will not be parsed. The solution is to generate it once before putting it in the database, and then save it. .

What should I do if thinkphp does not parse u?

#The operating environment of this article: Windows 7 system, thinkphp v5.1 version, Dell G3 computer.

What should I do if thinkphp does not parse u?

Thinkphp’s U method cannot correctly parse the problem

When I use ThinkPHP’s U method, for example : Save the {:U(GROUP_NAME . '/Clear/clearCache')} in the template to the database in the form of a string, and then read it out from the database in the background and assign it to the foreground → Clear Cache, the result displayed on the front desk is Clear Cache , the URL generated by the U method is not parsed. What is the reason for this?

Problem analysis:

The template engine will only parse it once. The variables you use will only replace the variables with values, and will not go back after the replacement is completed. Check the value to see if there are tags to be parsed. Therefore, the data you save in the database should be data that does not contain TP tags.

Do not put this statement in the database

Solution: 1. Generate it once before putting it in the database, and then save it, 2. Generate it when using it , recommend the first type.

Recommended learning: "The latest 10 thinkphp video tutorials"

The above is the detailed content of What should I do if thinkphp does not parse u?. 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