Pass complex URL as parameter in PHP

后端 未结 2 1914
感情败类
感情败类 2021-02-14 08:18

I\'m trying to pass a complex URL as a url parameter but the problem occurs if the url contains & for example I want to pass the following link as a parameter

http:

2条回答
  •  别那么骄傲
    2021-02-14 08:39

    From what I understand, you'll need to replace & into &.

    $url = str_replace('&', '&', $url);
    

    & is reserved, used for separating GET parameters, & is for writing a literal ampersand in a URL.

提交回复
热议问题