Codeigniter 多语言导致 facebook 分享错误为什么?
Codeigniter multiple language cause facebook share error why?
我有一个多语言的项目,当我尝试在 Facebook 上分享它时出现此错误。
文件:path/Language.php:15 function:_error_handler.
function switch_lang($language = "") {
$language = ($language != "") ? $language : "english";
$this->session->set_userdata('site_lang', $language);
setcookie('site_lang', $language, time() + (86400 * 30), "/");
redirect($_SERVER['HTTP_REFERER']);//This is Line 15
//When I remove the redirect above it work.
}
这就是 switch_language 函数的调用方式。
<select class="form-control" onchange="javascript:window.location.href='<?php echo base_url(); ?>language/switch_lang/'+this.value;">
<option value="korean" <?php if($this->session->userdata('site_lang') == 'korean') echo 'selected="selected"'; ?> > 한국어 </option>
<option value="chinese" <?php if($this->session->userdata('site_lang') == 'chinese') echo 'selected="selected"'; ?> > 中文 </option>
</select>
我使用 javascript history.back 函数而不是 php redirect
来解决问题
echo '<script> window.history.back();</script>';
我有一个多语言的项目,当我尝试在 Facebook 上分享它时出现此错误。
文件:path/Language.php:15 function:_error_handler.
function switch_lang($language = "") {
$language = ($language != "") ? $language : "english";
$this->session->set_userdata('site_lang', $language);
setcookie('site_lang', $language, time() + (86400 * 30), "/");
redirect($_SERVER['HTTP_REFERER']);//This is Line 15
//When I remove the redirect above it work.
}
这就是 switch_language 函数的调用方式。
<select class="form-control" onchange="javascript:window.location.href='<?php echo base_url(); ?>language/switch_lang/'+this.value;">
<option value="korean" <?php if($this->session->userdata('site_lang') == 'korean') echo 'selected="selected"'; ?> > 한국어 </option>
<option value="chinese" <?php if($this->session->userdata('site_lang') == 'chinese') echo 'selected="selected"'; ?> > 中文 </option>
</select>
我使用 javascript history.back 函数而不是 php redirect
来解决问题echo '<script> window.history.back();</script>';