简体   繁体   English

Codeigniter Uri段未正确打印特殊字符

[英]Codeigniter Uri segments are not printing special characters correctly

I have url http://localhost/my_project/welcome/special_chars/äöü Now I am trying to print last segment using echo utf8_decode($this->uri->segment(3)); 我的网址是http:// localhost / my_project / welcome / special_chars /äöü现在,我尝试使用echo utf8_decode($ this-> uri-> segment(3))打印最后一段。 I am not getting the original value but when I write print like echo utf8_decode('äöü'); 我没有得到原始值,但是当我像echo utf8_decode('äöü');这样写print时; then I am getting proper value. 那么我就得到了适当的价值。

I think its something to do with permitted_uri_characters setting in the config. 我认为它是与permitted_uri_characters在配置设置。 You need to add your special character in the config like 您需要在配置中添加特殊字符,例如

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_()@&\-!';

For more info please refer this link: How do you allow URI encoded characters in CodeIgniter URLs? 有关更多信息,请参考此链接: 如何在CodeIgniter URL中允许URI编码的字符?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM