Gal*_*Gal 87 javascript php encoding encodeuricomponent
在PHP中,JavaScript的encodeURIcomponent相当于什么?
Gum*_*mbo 126
试试rawurlencode.或者更确切地说:
function encodeURIComponent($str) {
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
return strtr(rawurlencode($str), $revert);
}
Run Code Online (Sandbox Code Playgroud)
此功能完全适用于如何encodeURIComponent定义:
encodeURIComponent转义除以下字符外的所有字符:字母,十进制数字,-_.!~*'()
| 归档时间: |
|
| 查看次数: |
57657 次 |
| 最近记录: |