Smarty的变量调节器

阅读更多

一 代码

index.php
计算机类->php\n书名:《php从入门到精通》";
	$str3 = "\n价格:¥59/本。";
	$smarty->assign('title','使用变量修饰方法');
	$smarty->assign('str',$str1.$str2.$str3.$str4);
	$smarty->display('5/index.tpl');
?>
 
index.tpl




{$title}



原文:{$str}

变量中的字符数(包括空格):{$str|count_characters:true}
使用变量修饰方法后:{$str|nl2br|upper}

 
二 运行结果
原文:这是一个实例。 图书->计算机类->php 书名:《php从入门到精通》 价格:¥59/本。

变量中的字符数(包括空格):76 
使用变量修饰方法后:这是一个实例。
图书->计算机类->PHP
书名:《PHP从入门到精通》
价格:¥59/本。

你可能感兴趣的:(Smarty,变量调节器)