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
最新のブログ記事(新着順)
- 立体感がリアルなON・OFFスイッチ実装jQueryデモ
- PHPフレームワークにTwitter,Facebook等の認証を速攻実装できる「Opauth」
- 2012年5月23日 管理人のブックマーク
- PC・スマホ・タブレットで動くクールなHTML5スライドショー実装ができる「Juicebox」
- 既にここまで出来るWebGLのデモ22
- 2012年5月22日 管理人のブックマーク
- CSSな吹き出しを作れるWEBツール「cssarrowplease」
- PHP+Bootstrapで書かれた美しいGitリポジトリビューア「GitList」
- 2012年5月21日 管理人のブックマーク
- CSS3で描かれたシェイプのサンプル集
- 過去のエントリ



















間違いの指摘をしていただける方はメール、あるいはTwitter/FBでお願いします(クリック)



