Home  >  Article  >  Backend Development  >  Solution to the failure of Smarty variable regulator, smarty variable regulator_PHP tutorial

Solution to the failure of Smarty variable regulator, smarty variable regulator_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:20:29902browse

Solution to the failure of Smarty variable regulator, smarty variable regulator

Smarty’s variable regulator is a good thing. It has always been easy to use. However, when I used the variable regulator yesterday, I found that it didn’t work.

Copy code The code is as follows:

{$name | upper}

I read the manual carefully, looked at the smarty loading path, and checked up and down for nearly an hour but still couldn't find the problem. When I was about to fall into a helpless predicament, I deleted the code and rewrote it as
Copy code The code is as follows:
{$name|upper}

The result is great. It turns out that the variable must be directly followed by a vertical bar, the function name, and there must be no spaces in the middle, otherwise the function of the variable regulator will be invalid. After a long time of fussing, it turned out that it was caused by a space. It was so unworthy! ! !

It seems that when adjusting the smarty program in the future, you have to pay attention to the space problem. Maybe other problems may also be caused by spaces, and problems caused by spaces are the hardest to find.

Problems with defining variables in smarty

There is no difference between the two types

Add me if you are a php+smarty developer. I am a newbie. QQ 544630057 Everyone. We urgently need your help

It's very simple, just look at the Smarty template manual and you will know!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/866673.htmlTechArticleSolution to the failure of Smarty variable regulator, smarty variable regulator Smarty variable regulator is a good thing, it has always been It has always been easy to use, but yesterday when I used the variable regulator, I discovered...
Statement:
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