Try rawurlencode
. Or to be more precise:
function encodeURIComponent($str) {
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
return strtr(rawurlencode($str), $revert);
}
This function works exactly how encodeURIComponent
is defined:
encodeURIComponent
escapes all characters except the following: alphabetic, decimal digits, -
_
.
!
~
*
'
(
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…