介绍
这篇文章主要介绍smarty使用外部函数的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
<强>,1。系统函数使用:强>
& lt; ! DOCTYPE html> & lt; html> & lt; head> ,,,& lt; title> & lt;/title> & lt;/head> & lt; body> ,,,,,,,{strlen (& # 39; helloworld # 39;)}//在模板中需要对函数使用一个相应的边界符{}。 & lt;/body> & lt;/html>
<强>,2。自定义函数使用:强>
& lt; html>,,//smarty.html 模板 ,,,& lt; header> & lt;/header> ,,,& lt; body> ,,,,,,,{SpeakHello ()} ,,,& lt;/body> & lt;/html>
& lt; php ? include & # 39; smarty/Smarty.class.php& # 39;;//实例化自作聪明的家伙 $ smarty =, new Smarty (); function SpeakHello(){,,,,,,//必须在模板加载入内存之前 ,,,echo “hello"; } $ smarty→显示(& # 39;smarty.html& # 39;); ?在
以上是“smarty使用外部函数的方法”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!