0

I have this url which I need to pass to the browser and would like to encode it. However I have numbers in the url string which also gets converted and thus causes issues.

Here is my string.

"http://domain.com/?w=132&h=132&zc=1&q=90&a=c"

And if i use htmlspecialchars, it would convert both 132 to 100 which is wrong. How to prevent that?

UPDATE: perhaps I should mention that my string looks like that because I am using timthumb script.

Also I am not even sure if I need to encode anything? or is the URL i provided safe?

4

3 に答える 3

3

間違っていたらすみませんが、代わりに urlencode を使うべきではありませんか?

urlencode()? PHP.net リファレンス

于 2012-02-15T22:37:35.163 に答える
2

htmlspecialchars数値には影響しません...それを得るためにあなたが何をしているのかわかりません...

とにかく通すだけurlencode()

于 2012-02-15T22:38:06.767 に答える
0

htmlspecialchars()は 5 文字のみを変換します。

'&' (ampersand) becomes '&'
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
"'" (single quote) becomes ''' only when ENT_QUOTES is set.
'<' (less than) becomes '&lt;'
'>' (greater than) becomes '&gt;'

数字、文字、またはその他の記号には触れません。

于 2012-02-15T22:45:23.627 に答える