public function __construct(){
$this->languages = get_option('test_trans');
$this->default_lang = $this->default_language();
$this->taxonomies = get_taxonomies(array(),'names');
add_action('init', array($this, 'webchanics_e_translations_session_master'), 1);
session_start();
$this->current_language = $_SESSION['language'];
}
function webchanics_e_translations_session_master(){
if(!$this->languages){
unset($_SESSION['language']);
}else{
$check_lang_by_session = $this->check_language($_SESSION['language']);
if(!$check_lang_by_session){
$_SESSION['language'] = $this->default_lang;
}
$check_lang_by_url = $this->check_language($_GET['lang']);
if($check_lang_by_url){
$_SESSION['language']=$_GET['lang'];
}
}
}
此代碼將基於一些條件的會話,並呼叫在這屆stroed值。在課堂外,會話的新值立即可用,但在課程內部,$ this-> current_language的值保持舊值,直到我再次刷新頁面。這是什麼解釋?以及如何讓課堂內的價值立即改變?
這是不對的它,它不是一個重複 –