【发布时间】:2018-04-13 06:53:09
【问题描述】:
我在 php 文件中有这个函数,它已经包含在每个页面中
function ismobile(){
$detect = new Mobile_Detect;
if($detect->isiOS()){
return'ios';
}elseif($detect->isAndroidOS()){
return'android';
} }
我尝试使用此代码在 smarty tpl 文件中获取移动系统
{$ismobile}
但如果我使用的是 iphone 或 android,它不会像 ios 那样显示系统
【问题讨论】:
-
在你的控制器中获取函数的返回值并将其分配给一个模板变量。
标签: php function templates return smarty