Home > Backend Development > PHP Tutorial > Smarty能不能登记这样的插件

Smarty能不能登记这样的插件

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:00:34
Original
866 people have browsed it

Smarty能不能注册这样的插件?
通常注册的插件函数,都是在模板文件里面调用的。我的目的不是添加这样的函数,而是添加在PHP脚本里面调用的,就像display()这样的函数的调用方式。也就是相当于重载Smarty类,为Smarty类添加函数。除了重载Smarty类这个方法之外,能不能像注册插件那样注册一个自定义的函数?
------解决方案--------------------
给Smarty类加一个 __call 方法

我想Smarty应该不会那么低级,应经做过了吧
------解决方案--------------------
不用模板的方式注册插件!--call?没看明白!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
smarty turns on caching garbled characters
From 1970-01-01 08:00:00
0
0
0
Why does tp use smarty template? ?
From 1970-01-01 08:00:00
0
0
0
How do you use smarty to integrate laravel5?
From 1970-01-01 08:00:00
0
0
0
Two ways to install smarty
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template