Posted By

miniake on 09/01/10


Tagged

browser language


Versions (?)

Determine Browser Language


 / Published in: PHP
 

URL: http://wsqsite.com/

  1. <?php if (preg_match('/zh-tw/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) : ?>
  2. var browserlang = "zh-TW";
  3. <?php else : ?>
  4. var browserlang = "<?php echo substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) ?>";
  5. <?php endif; ?>

Report this snippet  

You need to login to post a comment.