PHP - How to replace special characters for url

前端 未结 6 1035
囚心锁ツ
囚心锁ツ 2021-01-29 11:45

I am trying to convert special characters (eg. +, /, &, %) which I will use them for a GET request. I have constructed a

6条回答
  •  礼貌的吻别
    2021-01-29 12:00

    Do not use a loop.

    Use str_replace

    str_replace($entities, $replacements, $string);
    

    Or better use this native PHP function rawurlencode

提交回复
热议问题