Passing & in query string

前端 未结 4 1275
误落风尘
误落风尘 2021-01-21 08:59

I want to pass \'&\' operator in query string. I tried to use urlencode and urldecode but its not working. I am doing this:

$abc=\"A & B\";
$abc2=urlenc         


        
4条回答
  •  天涯浪人
    2021-01-21 09:17

    Try this:

    $url = '?' . http_build_query(array(
      'say' => 'A & B'
    ));
    
    // Then just:
    echo $_GET['say'];
    

    Live example: http://codepad.viper-7.com/ibH79a?say=A+%26+B

提交回复
热议问题