标签:
自定义方法
要放在plugins文件中,并且文件名必须按照smary的成品方法名格式来定义,一般是function.自定义名称.php.
例子:
<?php function smarty_function_sub_change($args) { $code = $args[‘code‘]; $db = new MySQLi("localhost","root","","mydb"); $sql = "select name from subject where code = ‘{$code}‘"; $result = $db->query($sql); $arr = $result->fetch_row(); return $arr[0]; }
标签:
原文地址:http://www.cnblogs.com/Itwonderful/p/5561977.html