php smarty变量的修饰
test.php代码: view plaincopy to clipboardprint?
assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?>
assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?> test1.html模板代码: view plaincopy to clipboardprint?
Total is {$total}
Formatted Total is {$formatted_total}
Total is {$total}
Formatted Total is {$formatted_total}
编译后的test.html.php代码: view plaincopy to clipboardprint?
Total is _tpl_vars['total']; ?>
Formatted Total is _tpl_vars['formatted_total']; ?>
Total is _tpl_vars['total']; ?>
Formatted Total is _tpl_vars['formatted_total']; ?>
test1.html模板可以改写成这样test2.html: view plaincopy to clipboardprint?
Total is {$total}
Formatted Total is {$total|number_format}
Total is {$total}
Formatted Total is {$total|number_format}
则相应的test.php代码改为: view plaincopy to clipboardprint?
assign("total",$total); //对模版中的变量赋值 $smarty->display('test2.htm'); //显示页面 ?>
assign("total",$total); //对模版中的变量赋值 $smarty->display('test2.htm'); //显示页面 ?> 浏览器显示: Total is 12345 Formatted Total is 12,345 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhuzhao/archive/2009/03/19/4006030.aspx 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhuzhao/archive/2009/03/19/4006030.aspx
相关文档:
说明:
1、本文档是为初学PHP的朋友而制作的。
2、看了本文档学会PHP的朋友,请反馈你对本文档的意见或建议(发邮件到kuaiyigang@163.com或在QQ群4798654中提出),以帮助更多的初学者。
1、php语言的概述及开发环境的配置(1天)
a、php发展及应用介绍(了解)
b、php及相关软件在类linux和windows的具体安装步骤 (初 ......
php中DIRECTORY_SEPARATOR 与 PATH_SEPARATOR的区别
DIRECTORY_SEPARATOR:路径分隔符,linux上就是’/’ windows上是’\’
PATH_SEPARATOR:include多个路径使用,在win下,当你要include多个路径的话,你要用”;”隔开,但在linux下就使用”:”隔开的。
这2个常 ......
php的函数分为系统函数,用户函数
1,php函数不区分大小写
函数原型:
返回类型 函数名称(类型 参数)
2.1,系统函数中常用的数学函数
abs(eumber) 去绝对值
sin(float) 正弦计算sin(x)
cos(float) 余弦计算cos(x)
log(float) 自然对数计算
sqrt(float) 开平方根计算
log10(float) 10基底的对数
ex ......
原文链接:http://www.phpdo.net/index.php/2010/01/27/1-3/
昨天我们实现了PHP的第一个页面hello,world!
PHP的语言构成与工作原理是什么呢?
宏观地将:一个完整的PHP程序是由主程序和函数构成。PHP程序的执行从主程序开始,调用其他函数后返回主程序并结束。
在PHP的主程序和函数中,PHP函数的基 ......