How do you pass a URL into a CodeIgniter controller? [duplicate]

删除回忆录丶 提交于 2019-12-02 20:38:40

问题


Possible Duplicate:
url encoded forward slashes breaking my codeigniter app

This is my controller:

class Foo extends Controller
{
   public function bar($url) {
       echo 'hello world';
   }
}

If I pass in a normal string into the bar function, I see "hello world" printed out.

http://website.com/index.php/foo/bar/argument

If I pass in a URL encoded string into the bar function, I get an error.

http://website.com/index.php/foo/bar/http%3A%2F%2Fwww.yahoo.com

.

Not Found

The requested URL /index.php/foo/bar/http://www.yahoo.com was not found on this server.


回答1:


use base64_encode() and base64_decode() to encode/decode the url, but you may need to add more character in your permitted uri config.



来源:https://stackoverflow.com/questions/7183745/how-do-you-pass-a-url-into-a-codeigniter-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!