如何将URL传递给CodeIgniter控制器?

时间:2011-08-25 00:03:26

标签: php url codeigniter

  

可能重复:
  url encoded forward slashes breaking my codeigniter app

这是我的控制者:

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

如果我将正常的字符串传入bar函数,我会看到打印出“hello world”。

  

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

如果我将URL编码的字符串传入bar函数,我会收到错误。

  

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

  

未找到

     

请求的网址/index.php/foo/bar/ http://www.yahoo.com是   在此服务器上找不到。

1 个答案:

答案 0 :(得分:0)

使用base64_encode()base64_decode()对网址进行编码/解码,但您可能需要在允许的uri配置中添加更多字符。

相关问题