@ on click turns to @

2019-04-07 00:35发布

when the link is clicked containing the @ symbol, the url gives me %40, which is what I want. But once I click it, one second later it changes to %2540 right after I click. The click is within an email, then directed to the site, where %40 changes to %2540. How can I make it stop changing?

it is getting the params like this now:

$email=Yii::app()->request->getParam('email');

not sure what other information i should provide.

标签: php yii
3条回答
走好不送
2楼-- · 2019-04-07 00:48

It happens when you are trying to call urlencode on a query string when you've already done it. So, the first call gives you %40 instead of "@". And the second call gives you %25 instead of %

查看更多
smile是对你的礼貌
3楼-- · 2019-04-07 00:58

There's not enough detail in your question to work out exactly why, but I can tell you at least what it is that's going on, and that should give you some clues.

A "@" has an ASCII code of hex 40, so when it gets escaped (i.e., turned into something without any special characters in it), it becomes "%40". But a "%" has an ASCII code of hex 25. If you escape a "%", you get "%25".

Your text is getting escaped twice: first to go from "@" to "%40", and then again to go from "%40" to "%2540".

查看更多
我想做一个坏孩纸
4楼-- · 2019-04-07 01:03

The issue is that your %40 is url-encoded again (since % encodes to %25), which gives you %2540.

查看更多
登录 后发表回答