smarty的自动过滤$smarty->auto_literal 会影响整体效能吗?
一直都是用{$aaa} 觉得顺手
觉得即便是JS和CSS
大不了用个{literal} ..... {/literal}
来过滤一下就好了
但没想到后来模版中js的json的东西越来越多
有点JQ插件甚至...需要foreach 我的数据,把数据加到json中
后来觉得还没正式推出,先用$smarty->auto_literal开发吧
但后来...怎么觉得多少有点变慢了
请问一下各位有使用过smarty的朋友,大家会打开这个吗$smarty->auto_literal?
如果都会打开这个,我用不用{ } 这附件其实都一样吧?
如果会影响效能,更换代码{ } 值得吗?
回复讨论(解决方案)
{literal} ..... {/literal} 和 $smarty->auto_literal 作用一样吗?
{literal} ..... {/literal} 从其单词含义就可看出(literal 文字)是不解析其间内容,哪怕有模板成分
而 $smarty->auto_literal 默认是 true 手册中解释为:忽略限定符周边的空白
即 { $aaa } 和 {$aaa} 都被解释为模版变量
而在 smarty 时代,通常是这样写样式表的
div { {$name} : {$val}; }
即用空格来防止误解析
模板解析是一次性的(当模板文件的存储时间发生变化时),所以无论你以什么样的策略来书写模板,都不会影响运行速度(第一次除外)
我是用{# #}做定界符的,避免那???。
{literal} ..... {/literal} 和 $smarty->auto_literal 作用一样吗?
{literal} ..... {/literal} 从其单词含义就可看出(literal 文字)是不解析其间内容,哪怕有模板成分
而 $smarty->auto_literal 默认是 true 手册中解释为:忽略限定符周边的空白
即 { $aaa } 和 {$aaa} 都被解释为模版变量
而在 smarty 时代,通常是这样写样式表的
div { {$name} : {$val}; }
即用空格来防止误解析
模板解析是一次性的(当模板文件的存储时间发生变化时),所以无论你以什么样的策略来书写模板,都不会影响运行速度(第一次除外)
喔
这个还真没分清楚
只知道能解决我的问题
div { {$name} : {$val}; } 这一招也学到了谢谢
我是用{# #}做定界符的,避免那个问题。
谢谢你的建议,#的确不错,网页中除了CSS#ID之外不会有什么冲突
谢谢两位,知道不会影响运作效能就行了

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



When trying to open a disk image in VirtualBox, you may encounter an error indicating that the hard drive cannot be registered. This usually happens when the VM disk image file you are trying to open has the same UUID as another virtual disk image file. In this case, VirtualBox displays error code VBOX_E_OBJECT_NOT_FOUND(0x80bb0001). If you encounter this error, don’t worry, there are some solutions you can try. First, you can try using VirtualBox's command line tools to change the UUID of the disk image file, which will avoid conflicts. You can run the command `VBoxManageinternal

What happens when someone calls in airplane mode? Mobile phones have become one of the indispensable tools in people's lives. It is not only a communication tool, but also a collection of entertainment, learning, work and other functions. With the continuous upgrading and improvement of mobile phone functions, people are becoming more and more dependent on mobile phones. With the advent of airplane mode, people can use their phones more conveniently during flights. However, some people are worried about what impact other people's calls in airplane mode will have on the mobile phone or the user? This article will analyze and discuss from several aspects. first

When using Quark Browser, there is a function to filter duplicate files. Some friends are not very familiar with this. Here I will introduce how to turn on this function. If you are interested, come and take a look with me. 1. First, click "Quark Browser" on your mobile phone to enter the interface, then click and select "Quark Network Disk" in the options in the middle of the page to open and enter. 2. Find "Backup Settings" in the lower part of the Quark network disk interface, and click to open it, as shown in the figure below: 3. Next, on the page you enter, there is a "Filter Duplicate Files", which is displayed behind it There is a switch button. Click the circular slider on it and set it to color to turn on this function. When you continue to back up files, duplicate files will be skipped to save network disk capacity.

Python implements XML data filtering and filtering. XML (eXtensibleMarkupLanguage) is a markup language used to store and transmit data. It is flexible and scalable and is often used for data exchange between different systems. When processing XML data, we often need to filter and filter it to extract the information we need. This article will introduce how to use Python to filter and filter XML data. Import the required modules Before starting, we

How to use PHP functions to search and filter data? In the process of developing using PHP, it is often necessary to search and filter data. PHP provides a wealth of functions and methods to help us achieve these operations. This article will introduce some commonly used PHP functions and techniques to help you search and filter data efficiently. String search Commonly used string search functions in PHP are strpos() and strstr(). strpos() is used to find the position of a certain substring in a string. If it exists, it returns

On the Douyin platform, users can not only share their life moments, but also interact with other users. Sometimes the comment function may cause some unpleasant experiences, such as online violence, malicious comments, etc. So, how to turn off the comment function of TikTok? 1. How to turn off the comment function of Douyin? 1. Log in to Douyin APP and enter your personal homepage. 2. Click "I" in the lower right corner to enter the settings menu. 3. In the settings menu, find "Privacy Settings". 4. Click "Privacy Settings" to enter the privacy settings interface. 5. In the privacy settings interface, find "Comment Settings". 6. Click "Comment Settings" to enter the comment setting interface. 7. In the comment settings interface, find the "Close Comments" option. 8. Click the "Close Comments" option to confirm closing comments.

Preface: vim is a powerful text editing tool, which is very popular on Linux. Recently, I encountered a strange problem when using vim on another server: when I copied and pasted a locally written script into a blank file on the server, automatic indentation occurred. To use a simple example, the script I wrote locally is as follows: aaabbbcccddd. When I copy the above content and paste it into a blank file on the server, what I get is: aabbbcccddd. Obviously, this is what vim does automatically for us. Format indentation. However, this automatic is a bit unintelligent. Record the solution here. Solution: Set the .vimrc configuration file in our home directory, new

Java is a commonly used programming language used to develop various applications. However, just like other programming languages, Java has security vulnerabilities and risks. One of the common vulnerabilities is the file inclusion vulnerability (FileInclusionVulnerability). This article will explore the principle, impact and how to prevent this vulnerability. File inclusion vulnerabilities refer to the dynamic introduction or inclusion of other files in the program, but the introduced files are not fully verified and protected, thus
