PHPで使えるブラウザ等プラットフォーム検出用クラス
2006年11月07日-
スポンサード リンク
Browser Detection with PHP
Browser detection is an illusive task that is ultimately doomed to fail. Browsers are always changing and keeping up to date with these changes is a continuous job. Some browsers allow the user to alter the way the browser identifies itself, or to not identify itself at all. Some firewalls block the sending of the browser identification, so no browser detection scheme is entirely successful.
PHPで使えるブラウザ等のプラットフォーム検出用クラス。
次のサンプルで簡単に各種情報をPHPにて取得できます。Opera/Safariなんかにも対応してます。
<?php
require('detect.php');
$b = new browser();
echo $b->Name; // 「MSIE」などのブラウザ名を取得
echo "<br>";
echo $b->Version; // 「6.0」などのバージョンを取得
echo "<br>";
echo $b->Platform; // 「Windows」などのOSを取得
?>
PEAR にも Net_UserAgent_Detect というクラスが存在しますが、今回紹介したものもなかなかシンプルに使えてよいのではないでしょうか。
スポンサード リンク
Advertisements
SITE PROFILE
最新のブログ記事(新着順)
- 2000種類以上の汎用ピクトグラムアイコン集「Atlas Icons」
- かわいい手書き風フォント「うさぎとまんげつのサンセリフ」
- ランディングページのサンプル集「Landings」
- WEBのUIコンポーネントギャラリー「The Component Gallery」
- 汎用で使える700+のピクトグラムアイコン「Sargam Icons」
- 白黒写真をWEB上で簡単にカラーにできる「Palette」
- iPhone14Proのモックアップ
- 建築素材風のおしゃれな背景画像「Architextures」
- クールな今どきのギャラリーサイトを作れるサンプル
- SVG形式の背景パターンなどをWEBで生成できる「fffuel」
- 過去のエントリ