? PHP ?,??????????? URL ????????,????? urlencode()
? urldecode()
??????????
- URL ??(??
urlencode()
??):
$url = "https://www.example.com?param1=value1¶m2=value2"; $encoded_url = urlencode($url); echo "Encoded URL: " . $encoded_url; // ??:Encoded URL: https://www.example.com?param1=value1¶m2=value2
- URL ??(??
urldecode()
??):
$decoded_url = urldecode($encoded_url); echo "Decoded URL: " . $decoded_url; // ??:Decoded URL: https://www.example.com?param1=value1¶m2=value2
????????????????,???? PHP ?????? openssl
?????? openssl_encrypt()
? openssl_decrypt()
????????????:
- ??(??
openssl_encrypt()
??):
$data = "https://www.example.com?param1=value1¶m2=value2"; $encryption_method = "AES-256-CBC"; $key = "your-secret-key"; // ???????? 32 ???(256 ?) $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($encryption_method)); $encrypted_data = https://www.yisu.com/ask/openssl_encrypt($data, $encryption_method, $key, 0, $iv);"Encrypted data: " . base64_encode($encrypted_data . '::' . $iv) . PHP_EOL; // ??:Encrypted data: base64????????::iv?
- ??(??
openssl_decrypt()
??):
$encrypted_data = https://www.yisu.com/ask/base64_decode($encrypted_data .'::' . $iv); // ???????????? IV $decrypted_data = https://www.yisu.com/ask/openssl_decrypt($encrypted_data, $encryption_method, $key, 0, $iv);"Decrypted data: " . $decrypted_data . PHP_EOL; // ??:Decrypted data: https://www.example.com?param1=value1¶m2=value2
???,?????????????,??????????????(? AES-256-CBC),??????????????????,???????????????????