/* rawurlencode() 함수로 쿼리 파라미터 값을 인코딩 */
$keyword = 'iPhone & Galaxy/Note=100% #1';
$encoded = rawurlencode($keyword);

echo 'https://example.com/search?query=' . $encoded;
// 출력: 'https://example.com/search?query=iPhone%20%26%20Galaxy%2FNote%3D100%25%20%231'

/* urlencode()로 인코딩된 쿼리 파라미터 값을 디코딩 */
$decoded = rawurldecode($encoded);
echo $decoded;
// 출력: 'iPhone & Galaxy/Note=100% #1'
rawurldecode(string $string): string
$server_url = 'https://www.example.com';
$image_path = '/images/my image.jpg';

// 파일 경로를 URL에 추가할 때 rawurlencode() 함수 사용
$encoded_image_path = rawurlencode($image_path);

$image_url = $server_url . $encoded_image_path;

echo $image_url . '<br>';
// 출력: 'https://www.example.com%2Fimages%2Fmy%20image.jpg'

$rawurlencode_image_path  = rawurldecode($image_path);
echo $rawurlencode_image_path;
// 출력: '/images/my image.jpg'