Is there a way in PHP to encode special characters so they can be used in an URL?

末鹿安然 提交于 2019-12-11 19:07:27

问题


I have a string that comes from an AES encryption like this -> "‚±«~—ÄÔý 3ƒÛœÛ" Is there a way to encode this string so it can be transmitted to a script via URL?

Thank You!


回答1:


you can use urlencode or base64_encode for that task, both will produce url safe strings




回答2:


Yes!

Use the global function

urlencode($string)

If you want to get the original paramters you can decode the URL-Parameters with:

urldecode($string)


来源:https://stackoverflow.com/questions/15011680/is-there-a-way-in-php-to-encode-special-characters-so-they-can-be-used-in-an-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!