if (!Func::isWx()) { exit('请在微信客户端打开链接'); }
// 判断是否是微信 public static function isWx() { if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) { return true; } return false; }
这样就保证了环境的正确