Created
December 13, 2013 20:24
-
-
Save fethica/7950768 to your computer and use it in GitHub Desktop.
Detect Browser Language in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); | |
switch ($lang){ | |
case "fr": | |
//echo "PAGE FR"; | |
include("index_fr.php");//include check session FR | |
break; | |
case "it": | |
//echo "PAGE IT"; | |
include("index_it.php"); | |
break; | |
case "en": | |
//echo "PAGE EN"; | |
include("index_en.php"); | |
break; | |
default: | |
//echo "PAGE EN - Setting Default"; | |
include("index_en.php");//include EN in all other cases of different lang detection | |
break; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment