{math}鍙互璁╂ā鏉胯璁¤�呭湪妯℃澘涓繘琛屼竴浜涙暟瀛﹁繍绠椼��
浠讳綍鍦ㄦā鏉夸腑鐨勬暟瀛楀彉閲忛兘鍙互杩涜璁$畻锛岃�岃绠楃殑缁撴灉浼氭浛浠e師鏉ョ殑鏍囩銆�
妯℃澘鍙橀噺鎴栬�呴潤鎬佺殑鍊奸兘鍙互浣滀负鍙傛暟杩涜璁$畻銆�
鍙互鍏佽鐨勮绠楁湁 +, -, /, *, abs, ceil, cos, exp, floor, log, log10, max, min, pi, pow, rand, round, sin, sqrt, srans 鍜� tan 銆� 鍙傝PHP鎵嬪唽锛屼簡瑙�math 鍑芥暟銆�
濡傛灉浣犳彁渚涗簡
assign灞炴�э紝{math}鍑芥暟鐨勮緭鍑哄皢涓嶄細鏄剧ず锛岃�屾槸璧嬪�肩粰妯℃澘鍙橀噺銆�
鎶�鏈鏄�
鍥犱负浣跨敤浜哖HP鍑芥暟
eval()锛屾墍浠�{math}鏄竴涓瘮杈冭�楄垂鎬ц兘鐨勬搷浣溿��
鍦≒HP涓仛鏁板杩愮畻浼氭洿楂樻晥锛屾墍浠ュ敖鍙兘鍦≒HP杩涜鏁板杩愮畻骞朵笖鎶婄粨鏋�
assign()鍒版ā鏉夸腑銆�
姣旇緝涓嶅缓璁殑鍋氭硶鏄湪寰幆涓娇鐢�{math}鍑芥暟锛屾瘮濡傚湪
{section}寰幆銆�
| 鍙傛暟鍚嶇О | 绫诲瀷 | 蹇呴�夊弬鏁� | 榛樿鍊� | 璇存槑 |
|---|---|---|---|---|
| equation | string | Yes | n/a | 鏁板杩愮畻寮� |
| format | string | No | n/a | 缁撴灉鐨勬樉绀烘牸寮�(sprintf) |
| var | numeric | Yes | n/a | 杩愮畻鐨勫彉閲忓�� |
| assign | string | No | n/a | 鐢ㄤ簬璧嬪�肩殑鍙橀噺鍚� |
| [var ...] | numeric | Yes | n/a | 杩愮畻鐨勫彉閲忓�� |
Example聽8.21.聽{math}
渚嬪瓙 a:
{* $height=4, $width=5 *}
{math equation="x + y" x=$height y=$width}
杈撳嚭锛�
9
渚嬪瓙 b:
{* $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#}
杈撳嚭锛�
100
渚嬪瓙 c:
{* you can use parenthesis *}
{math equation="(( x + y ) / z )" x=2 y=10 z=2}
杈撳嚭锛�
6
渚嬪瓙 d:
{* you can supply a format parameter in sprintf format *}
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
杈撳嚭锛�
9.44
