Home > Backend Development > PHP Tutorial > smarty中可以将函数调用结果存入变量吗?

smarty中可以将函数调用结果存入变量吗?

WBOY
Release: 2016-06-06 20:51:31
Original
958 people have browsed it

项目中有个需求:提供了一个php函数,返回bool值,而且这个函数已经register到smarty模板中,模板中要调用这个函数,并根据返回结果判断显示什么内容,smarty中可以将函数调用结果存入变量吗?

回复内容:

项目中有个需求:提供了一个php函数,返回bool值,而且这个函数已经register到smarty模板中,模板中要调用这个函数,并根据返回结果判断显示什么内容,smarty中可以将函数调用结果存入变量吗?

哈哈,自已搞定了,例子如下:


$this->assign('result', api('ip.client_ip'));

参考:http://www.smarty.net/docs/en/languag...

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template