在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 :(

我正在尝试使用我的新wordpress插件,我遇到了一个问题。 我正在设置一个 变量包含这样的东西: esc_html('likeit'.wp_generate_password(4)) p>

然后 - 我想通过GET调用另一个函数,但它有时会破坏。 例如 如果我有:likeitA9& n,它将会在&。 p>

你可以告诉我在我的插件中处理这个问题的最佳(也是最安全)但最简单的方法是什么? n例子将不胜感激! p>

非常感谢! p>

PS - 我确实试着查看以前的帖子,但实际上没有解决这个问题:( p> div>

urlencode('likeit'.wp_generate_password(4));

or

rawurlencode('likeit'.wp_generate_password(4));