user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === t
rue) {}
我在是classes/common.php文件中写了一个函数:
/**
* 获取是否微信登陆
* @return String
*/
public static function getWeixinLogin()
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === true){
return true;
}
}
这样在哪里都可以用了
{if:Common::getWeixinLogin()}
<tr>
<td></td>
<td><span class="iconfont mpay2"></span></td>
<td><span id="mpay1">微信支付</span></td>
<td><input name="select_pay" value="13" type="radio" id="checkbox-3-7"><label for="checkbox-3-7"></label></td>
<td></td>
</tr>
{/if}