Get Smarty

Donate

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap glasses from Cheapglasses123.com and save up to 80%.

Where to buy prescription glasses? EyewearCanada.com is your best choice!

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Shop for 2018 World Cup Football Boots Online sale at guthjcc.com

Browse best 2018 world cup soccer cleats and shoes from SoccerAzteca.com

Advertisement

escape

escape dipakai untuk mengkodekan atau mengubah variabel ke contohnya html, url, tanda kutip tunggal, heksa, heksentitas, javascript dan mail. Standarnya html.

Posisi ParameterTipeDiperlukanNilai yang MungkinDefaultDeskripsi
1stringTidakhtml, htmlall, url, urlpathinfo, quotes, hex, hexentity, javascript, mail htmlIni adalah format escape yang digunakan.
2stringTidakISO-8859-1, UTF-8, dan setiap karakter yang didukung oleh htmlentities() ISO-8859-1Set karakter yang semuanya dikirimkan ke htmlentities().

Teladan 5-10. escape

assign(\'articleTitle\', "\'Stiff Opposition Expected to Casketless Funeral Plan\'" ); $smarty->assign(\'EmailAddress\',\'smarty@example.com\'); ?>'); ?>

Ini adalah contoh baris template escape diikuti oleh output

{$articleTitle}
'Stiff Opposition Expected to Casketless Funeral Plan'

{$articleTitle|escape}
'Stiff Opposition Expected to Casketless Funeral Plan'

{$articleTitle|escape:'html'}    {* escapes  & " ' < > *}
&#039;Stiff Opposition Expected to Casketless Funeral Plan&#039;

{$articleTitle|escape:'htmlall'} {* escapes SEMUA entri html *}
&#039;Stiff Opposition Expected to Casketless Funeral Plan&#039;

<a href="?title={$articleTitle|escape:'url'}">click here</a>
<a href="?title=%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27">click here</a>

{$articleTitle|escape:'quotes'}
\'Stiff Opposition Expected to Casketless Funeral Plan\'

<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
{$EmailAddress|escape:'mail'}    {* this converts to email to text *}
<a href="mailto:%62%6f%..snip..%65%74">&#x62;&#x6f;&#x62..snip..&#x65;&#x74;</a>

{'mail@example.com'|escape:'mail'}
smarty [AT] example [DOT] com

Teladan 5-11. Contoh lain

Fungsi PHP dapat dipakai sebagai pengubah, $security yang mengijinkan.

{* parameter "rewind" meregistrasi lokasi sekarang *}
<a href="{$SCRIPT_NAME}?page=foo&rewind={$smarty.server.REQUEST_URI|urlencode}">click here</a>

This snippet is useful for emails, but see also {mailto}

{* alamat email dipotong *}
<a href="mailto:{$EmailAddress|escape:'hex'}">{$EmailAddress|escape:'mail'}</a>

Lihat juga escaping penguraian smarty, {mailto} dan halaman mengaburkan alamat email.

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 7 plus 12? (Are you human?)

Advertisement