CodeIgniter - URI Disallowed Characters

2019-06-05 10:39发布

问题:

I had issue of @ which I added in $config['permitted_uri_chars'] as you can see below:

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

BUt here is my URL

http://mydomain.com/awarenessroom/facebook_image_share/aHR0cDovL2Rldi5lanVpY3lzb2x1dGlvbnMuY29tL3Jla2xhaW1wYWtpc3Rhbi5jb20vdXBsb2Fkcy9hd2FyZW5lc3Nfcm9vbS9pbWFnZXMvOTEwNzA4ODI3VG9yIERheSBaYW5qZWVyLmpwZw==

and it says "The URI you submitted has disallowed characters.", even if I add = in config, still not working. Can anybody let me know what is required exactly by CI in config to get resolved for URI to be working?

回答1:

As per your info you are using base64_encode so this i will suggest to you because i am following the same in my web application

$encode_string = "google.com";

$result = rtrim(base64_encode($encode_string ),'=');

$decoded_string = base64_decode($result);


回答2:

Please use url_encode(base64_encode(string)) and then decode it. It will help you for sure.



回答3:

use url_title() function

from this linkl http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html