URL包含%,%2f将是a /和%3d a = In yii


URL contain % ,%2f would be a / and the %3d a = In yii?

我在yii的网址是:

http://localhost/php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG%2Fg0jJFWjiWWdPnkq5VDlY%3D

我应该在url管理器中做些什么来得到这个,我目前的规则是:

'<controller:'w+>/ByCustomer/<giftcode>'=>'<controller>/ByCustomer',

实际上问题是我得到:

The requested URL     /php_pro_106/reload/ByCustomer/mJYwIzoaIGe0R8lAVCqPhG/g0jJFWjiWWdPnkq5VDlY= was     not found on this server.

这是因为URL中的%3D %2F。我要怎么做才能让它正常工作?

我知道apache在URL中有%2F问题,它总是会回复404,php脚本不执行。我从来没有找到办法。但那是几年前的事了。

编辑:

有一个解决方案,但它要求您至少可以为您的虚拟主机编辑apache配置文件(我当时没有)。然后在<VirtualHost>中加入AllowEncodedSlashes On。也可以全局设置

我得到了它的解决方案,为此我必须改变我的编码和解码方法:

function base64_url_encode($input) {
 return strtr(base64_encode($input), '+/=', '-_,');
}
function base64_url_decode($input) {
 return base64_decode(strtr($input, '-_,', '+/='));
} 

问题是由于一些字符在编码Url中存在。所以,我必须替换这些字符

这些链接帮助我:

Stackoverflow

google Group