使用 php 的激活密钥问题
我正在为我的 WordPress 安装使用自定义登录脚本。一切工作正常,除了当激活密钥以以下格式发送给注册用户时:
http://mydomain.com/?page_id=1278&[email protected]&activate_key=7edbad
但是,当用户单击上述链接时,电子邮件中的“@”消失,因此给出激活密钥无效的错误。
有人可以指导我吗?
这是将激活链接放在一起的代码片段:
$link=get_option('home').'/?page_id='.$pageid.'&mail='.$user_email.'&activate_key='.$key;
I'm using a custom login script for my wordpress installation. Everything works fine except that when the activation key is sent to registered users in the following format:
http://mydomain.com/?page_id=1278&[email protected]&activate_key=7edbad
When users click on the above link however, the '@' in the email disappears and therefore gives an error that the activation key is invalid.
Can someone guide me on this?
This is the piece of code that puts the activation link together:
$link=get_option('home').'/?page_id='.$pageid.'&mail='.$user_email.'&activate_key='.$key;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能需要使用
urlencode()
对该 URL 中的参数进行编码 每个参数值的函数:As an alternative, you could also use [**`http_build_query()`**][2] once, to build up the whole query string :
You probably need to encode the parameters in that URL, using the
urlencode()
function on each parameter's value :As an alternative, you could also use [**`http_build_query()`**][2] once, to build up the whole query string :
在 GET 参数上尝试
urlencode()
。Try
urlencode()
on the GET params.尝试将
$user_email
周围的urlencode()
将其转换为 URL 友好的值。Try
urlencode()
around the$user_email
to convert it to a URL-friendly value.