Home > Backend Development > PHP Tutorial > thinkPHP html 模版文件 的大括号,怎么转义?

thinkPHP html 模版文件 的大括号,怎么转义?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:06:32
Original
1692 people have browsed it

就是{$name}这种,我想输入一个字符串,不是真正的PHP变量,

怎么转义?我试了试用 \{$name\}不行..

回复内容:

就是{$name}这种,我想输入一个字符串,不是真正的PHP变量,

怎么转义?我试了试用 \{$name\}不行..

  1. 改变默认的开始标记和结束标记 参考链接

    <code>    'TMPL_L_DELIM'=>''}>',</code>
    Copy after login
  2. 可以使用literal标签来防止模板标签被解析 参考链接

    <code>    <literal>{$name}</literal></code>
    Copy after login

如果$name不是变量的话,那它也得转义吧

<code>\{\$name\}</code>
Copy after login
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template