file_get_contents with spaces in URL

前端 未结 2 1126
渐次进展
渐次进展 2021-01-12 04:02

I have an issue where even if I replace the spaces to %20 and get this content the ultimate url the browser gets turns the \"%20\" into \"%2520\"

Here\'s my code, an

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-12 04:54

    $data = json_encode($_POST);
    
    $url = "http://www.index.com?data=";
    
    echo file_get_contents($url . urlencode($data));
    

提交回复
热议问题