PHP: Encoded + is replaced by a space

There are many similar questions here, but I have not found anyone to help me. Basically, I have a line like this:

Collections/Linkin Park/Dead By Sunrise (2009) %2B Album Cover

The string is part of a longer URL, and this particular part is assigned to the $ _GET array using .htaccess RewriteRule. When I repeat the line stored in $ _GET, I get:

Collections/Linkin Park/Dead By Sunrise (2009) Album Cover

% 2B just disappears (three spaces are displayed in the web page source). Why is this? And how can I prevent this?

This is only a mistake with +. I know php treats + as a space, but should not when it is encoded.

+4
source share
1 answer

B flag , RewriteRule - :

RewriteRule ^Entertainment/Music/(.*)/$ ?sub=Entertainment&page=Music&e1=$1 [B,QSA,NC,L]

, $_GET, :

Array
(
    [sub] => Entertainment
    [page] => Music
    [e1] => Collections/Linkin Park/Dead By Sunrise (2009) + Album Cover
)

+ Album Cover.

+2

Source: https://habr.com/ru/post/1649416/


All Articles