rawurlencode
? PHP ?????????? URL ???????????????,?????????????????????????????????? rawurlencode
,????????????:
- ?? Composer ????:????????? Composer ??????,???????
composer.json
?????rawurlencode
??????,??rawurlencode
??? 1.0.0 ??,????composer.json
?????????:
{ "require": { "php": "^7.3|^8.0", "php-url": "^1.0" } }
???? composer update
???????? php-url
??
- ?? PHP ?????:
rawurlencode
? PHP ?????,??????????????????????????????rawurlencode
??,??:
$input = "Text to Encode !@#$"; $encoded = rawurlencode($input); echo $encoded; // ??:Text to Encode !@#$
- ????????????
rawurlencode
,??????? PHP ?version_compare
?????????? PHP ??,???????????????:
if (version_compare(PHP_VERSION, '7.3', '>=')) { // ?? PHP 7.3 ??????? rawurlencode ?? $encoded = rawurlencode($input); } else { // ?????? rawurlencode ??(????) }
???,rawurlencode
??? PHP 7.3 ????????,??????????????