不二先生
2015-07-27 12:25:16
網(wǎng)站進(jìn)行切換語(yǔ)言后,在搜索框中輸入信息,彈出的提示框的語(yǔ)言沒(méi)有變,同事說(shuō)傳值出現(xiàn)問(wèn)題,但我不知道哪里有問(wèn)題session_start();
$language?=?'en';
if(isset($_G['lang'])?&&?in_array($_G['lang'],?array('en','tc',?'sc'))){//如果lang為true?且?屬于數(shù)組array里,那么
????$language?=?$_G['lang'];
????$_SESSION['parsons_language']?=?$language;
}
else?if(isset($_SESSION['parsons_language'])?&&?!empty($_SESSION['parsons_language'])){
????$language?=?$_SESSION['parsons_language'];
}
else{
????$_SESSION['parsons_language']?=?$language;
}
//update?by?Ace?2014/10/14
//設(shè)置語(yǔ)言對(duì)應(yīng)數(shù)據(jù)庫(kù)的數(shù)據(jù)?存入session?在查詢數(shù)據(jù)庫(kù)的時(shí)候可以使用
//比如tc對(duì)應(yīng)數(shù)據(jù)庫(kù)Traditional?Chinese
switch($_SESSION['parsons_language']){
???case?'tc':
??????$_SESSION['parsons_language_specific']='Traditional?Chinese';
??????break;
???case?'sc':
??????$_SESSION['parsons_language_specific']='Simplified?Chinese';
??????break;
???case?'en':
??????$_SESSION['parsons_language_specific']='English';
??????break;
}
2 回答

大DS
TA貢獻(xiàn)3條經(jīng)驗(yàn) 獲得超0個(gè)贊
switch($_SESSION['parsons_language']){
???case?'tc':
??????$_SESSION['parsons_language_specific']='Traditional?Chinese';
??????break;
???case?'sc':
??????$_SESSION['parsons_language_specific']='Simplified?Chinese';
??????break;
???case?'en':
??????$_SESSION['parsons_language_specific']='English';
??????break;
}
我覺(jué)得$_SESSION['parsons_language'] ?傳值不是這么寫(xiě)的
$_SESSION['parsons_language'] 這個(gè)請(qǐng)用$_G['lang'] 替換。
添加回答
舉報(bào)
0/150
提交
取消