gpt4 book ai didi

PHP 警告 : preg_match(): Unknown modifier

转载 作者:可可西里 更新时间:2023-11-01 11:14:13 29 4
gpt4 key购买 nike

<分区>

我试图根据操作系统将用户重定向到不同的页面,但不断收到此警告:

PHP 警告:preg_match() [function.preg-match]:第 292 行/index.php 中的未知修饰符“2”

它似乎只发生在 Windows NT 5.1 和 MSIE 8.0 浏览器配置中:

function getOS($userAgent) {
// Create list of operating systems with operating system name as array key
$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 NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)',
'Windows ME' => 'Windows ME',
'Blackberry' => 'Blackberry',
'Open BSD'=>'OpenBSD',
'Sun OS'=>'SunOS',
'Linux'=>'(Linux)|(X11)',

'Macintosh'=>'(Mac_PowerPC)|(Macintosh)',
'QNX'=>'QNX',
'BeOS'=>'BeOS',
'OS/2'=>'OS/2',
'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)'
);
//'Safari' => '(Safari)',
foreach($oses as $os=>$pattern){ // Loop through $oses array
// Use regular expressions to check operating system type

if(preg_match("/".$pattern."/i", $userAgent)) {
// Check if a value in $oses array matches current
//user agent. <---- Line 292

尝试删除 OS/2 并更改为 OS2,但仍然重定向到带有 Windows XP 的 MSIE 8 的错误页面

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com