douhua1890 2014-10-08 14:09
浏览 577
已采纳

在HTTP标头中发送带有特殊字符的$ _GET请求(转义)

I'm trying to work on my new wordpress plugin, and I encountered an issue. I'm setting a variable to contain something like this: esc_html('likeit'.wp_generate_password(4))

And then - I want to call another function via GET, but it's sometimes breaking. For example if I have: likeitA9&n, it will break at &.

Can you please tell me what's the best (and most secured) but simple way to handle this in my plugin? Examples would be appreciated!

Thanks a lot!

P.S. - I did try to look at previous posts, but nothing that actually solved this :(

  • 写回答

1条回答 默认 最新

  • douzhoulei8959 2014-10-08 14:17
    关注
    urlencode('likeit'.wp_generate_password(4));
    

    or

    rawurlencode('likeit'.wp_generate_password(4));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请各位看看我写的属于什么算法,或者有更正确的写法?
  • ¥15 html5 qrcode 扫描器
  • ¥15 爬取网页信息并保存需要完整代码
  • ¥15 一分十不等功分器阻设计问题,请问这个56Ω怎么得到的
  • ¥15 (标签-matlab)
  • ¥100 求看看这个数学建模,有偿
  • ¥15 深度学习目标检测现在框架加注意力的创新可以投几区?
  • ¥15 PdfiumViewer pdf转图片
  • ¥15 利用Java连接API接口总是出问题
  • ¥15 请教一个关于镜头标定,棋盘格格子大小的问题(畸变测试)