小编Squ*_*Roe的帖子

PHP警告:preg_match()[function.preg-match]:未知的修饰符

任何人都知道为什么会出现这种情况?尝试使用此方法根据用户代理重定向用户.当用户代理是搜索机器人时,会出现此警告.Windows XP MSIE 8用户代理也被错误地重定向.

"警告:preg_match()[function.preg-match]:第36行/.../getos.php中的未知修饰符'c'"

function getOS($userAgent) {
  $oses = array (
    'iPhone' => '(iPhone)',
    'iPad' => 'iPad',
    'Android' => 'Android',
    'Windows 3.11' => 'Win16',
    'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)', // Use regular expressions as value to identify operating system
    'Windows 98' => '(Windows 98)|(Win98)',
    'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)',
    'Windows XP' => '(Windows NT 5.1)|(Windows XP)',
    'Windows 2003' => '(Windows NT 5.2)',
    'Windows Vista' => '(Windows NT 6.0)|(Windows Vista)',
    'Windows 7' => '(Windows NT 6.1)|(Windows 7)',
    'Windows …
Run Code Online (Sandbox Code Playgroud)

php internet-explorer windows-xp googlebot internet-explorer-8

0
推荐指数
1
解决办法
1333
查看次数