开发者

"HTTP_USER_AGENT" not working. nothing is displayed in my browser i.e. firefox

开发者 https://www.devze.com 2023-01-08 11:14 出处:网络
<?php $agent=getenv(\"HTTP_USER_AGENT\"); if(preg_match(\"/MSIE/i\", \"$agent\")){ $result=\"You are using Microsoft Internet Explorer.\";}
<?php
$agent=getenv("HTTP_USER_AGENT");
if(preg_match("/MSIE/i", "$agent")){
    $result="You are using Microsoft Internet Explorer.";}
    else if (preg_match("/Mozilla/i", "$agent")){
    $result= "You are using Firefox.";}
    else {$result = " you are using $agent.";}

?>
<html>
<head>
<title>Browse Match Results</tit开发者_如何学Gole>
</head>
<body>
<?php "<p>$result</p>";?>
</body>
</html>


Might I venture a guess, and suggest that:

<?php "<p>$result</p>";?>

Should be:

<?php echo "<p>$result</p>";?>


<?php echo "<p>$result</p>";?>

0

精彩评论

暂无评论...
验证码 换一张
取 消