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
相关文档:
When I deploy php application on apache, some problem come out, and solved. Here's the tips and problems solved.
0.How could I deploy an apache server armed with php, mysql, perl, and phpMyAdmin on the fly?
You need a package bundled with all these tools, xampp shall meet you needs, you can ......
原文链接:http://www.phpdo.net/index.php/2010/01/25/29/
学习了一段时间PHP,觉得有点收获。也应该将学过的东西拿出来晒晒了,不然就交回给课本了。
PHP是什么呢?
PHP,是超级文本预处理语言(PHP:Hypertext Preprocessor)的缩写。PHP 是一种 HTML 内嵌式的语言,是一种在服务器端执行的嵌入HTML文档的脚本语言,语 ......
原文链接:http://www.phpdo.net/index.php/2010/01/26/1-2/
所有编程语言的开始:Hello,world!页面。
首先使用html编写一个简单的页面。代码如下:
<html>
<head>
<title>Hello, world</title>
</head>
<body>
<H1><p align=center>Hello, world</p></H1 ......
php的函数分为系统函数,用户函数
1,php函数不区分大小写
函数原型:
返回类型 函数名称(类型 参数)
2.1,系统函数中常用的数学函数
abs(eumber) 去绝对值
sin(float) 正弦计算sin(x)
cos(float) 余弦计算cos(x)
log(float) 自然对数计算
sqrt(float) 开平方根计算
log10(float) 10基底的对数
ex ......