$url = 'https://www.example.com/page.php?name=John Doe';
$encoded_url = rawurlencode($url);
echo $encoded_url;

// 출력: https%3A%2F%2Fwww.example.com%2Fpage.php%3Fname%3DJohn%20Doe
rawurlencode(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;

// 출력: https://www.example.com%2Fimages%2Fmy%20image.jpg