smarty四则运算里面如何用小括号
format
height
quot
smarty
width
smarty四则运算里面怎么用小括号?
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?phprequire_once "include/smarty_config.php";$a=1;$b=2;$c=7;$smarty->assign("a",$a);$smarty->assign("b",$b);$smarty->assign("c",$c);$smarty->display("t.tpl");?>
登入後複製
- HTML code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->a+b:<br>a/c:<br>(a+b)/c:<br>
登入後複製
以上是程序和模板。
要怎么做才可以实现(a+b)/c?
------解决方案--------------------
你应该尽量在php中运算。再assign给模板。
另外。你的代码有什么错?
------解决方案--------------------
提示什么错误? php完全可以把各结果得到了再传给smarty。不就是多几个变量或是数组的问题。
------解决方案--------------------
看看这篇博文
------解决方案--------------------
加括号把,由于没有smarty环境。测试不了。看其他朋友怎么说。
------解决方案--------------------
smarty中的四则运算
已有 567 次阅读2006-12-4 11:14 |个人分类:PHP
0
{* $height=4, $width=5 *}
{math equation="x + y" x=$height y=$width}
OUTPUT:
9
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
{math equation="height * width / division"
height=$row_height
width=$row_width
division=#col_div#}
OUTPUT:
100
{* you can use parenthesis *}
{math equation="(( x + y ) / z )" x=2 y=10 z=2}
OUTPUT:
6
{* you can supply a format parameter in sprintf format *}
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
OUTPUT:
9.44
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前
By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
擊敗分裂小說需要多長時間?
3 週前
By DDD
R.E.P.O.保存文件位置:在哪里以及如何保護它?
3 週前
By DDD

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)