Getting Param from the Url is missing special character

My Url like this -


http://localhost/yiidemo/site/confirm?_active=AHjh15soPgg+erHFsgyOI5+ldd34fdIWPdlTEe

when i print _active this -


echo Yii::app()->request->getQuery('_active');


//output - AHjh15soPgg erHFsgyOI5 ldd34fdIWPdlTEe

Missing the ‘+’ sign. I’m getting space ’ ’ instead of ‘+’ sign.

How to resolve this types issue… thanks in advance!!

That’s expected behaviour. The plus sign is a URL encoded version of a space character.

How are you generating the URL?

Thanks for the reply. I’m using mcrypt_encrypt method -


mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_CBC, $iv)

But how are you generating the whole URL? Are you just appending the query string to the end or using one of Yii’s URL creation methods?

You have to encode url as:




urlencode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_CBC, $iv));