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

在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 帮我调试idea基于spring boot项目
  • ¥15 es 7.17.20版本生成时间戳
  • ¥15 wpf dategrid表头排序图标自定义
  • ¥15 分析下图所示同步时序逻辑电路的逻辑功能。
  • ¥15 halcon联合c#遇到了问题不能解决
  • ¥15 xshell无法连接提示ssh服务器拒绝密码
  • ¥15 AT89C52单片机C语言关于串口通信的位操作
  • ¥20 需要步骤截图(标签-服务器|关键词-map)
  • ¥50 gki vendor hook
  • ¥15 灰狼算法和蚁群算法如何结合