PHP istemci işletim sistemi belirlemek

3 Cevap

Benim index.php iki sayfa yönlendirmeyi var. Sayfalar example_system_os.php ve example_mobile_os.php bulunmaktadır.

PHP kullanıcının işletim sistemini belirlemek için?

3 Cevap

Tarayıcı tarafından gönderilen get_browser function can be used to extract a couple of information the User-Agent HTTP başlık.

Istemci işletim sistemi hakkında - yani bu bilgiler arasında, bu işletim sistemi tarayıcının çalışan hakkında bazı veriler var gibi görünüyor.


Quoting the example given on the manual page of get_browser :

Array
(
    [browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
    [browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
    [parent] => Firefox 0.9
    [platform] => WinXP
    [browser] => Firefox
    [version] => 0.9


But note that the User-Agent HTTP header is sent by the client, which means :

  • Bu devre dışı bırakılabilir
  • Bu sahte olabilir (i.e. you can get any kind of garbage in it ^^ )

Eğer çeşitli platformu ayrıntılar için $_SERVER['HTTP_USER_AGENT'] dizesini ayrıştırmak, ama kolayca taklit edilebilir çünkü bu, deterministik bir yaklaşım oldu emin olmaz.

Sorun sabit, ben get_browser funcion kullandık.