在图片上显示网站访客IP地址的php代码

下面是代代码:

<?php  
 //Creating the image  
 header (“Content-type: image/gif”);  
 $image=imagecreatefromgif(“http://localhost/host/jupress/images/ipboard.gif”);  
 
 //Making some colors  
 $black = imagecolorallocate($image, 0,0,0);  
 
 //Getting the user’s IP address and text to display
 $ip_address = $_SERVER[‘REMOTE_ADDR’];  
 $message = “jupress.com”;  
 
 //Displaying IP address on the image.  
 imagestring($image, 4, 25, 10, $message, $black);  
 imagestring($image, 4, 20, 27, $ip_address, $black);  
 
 //Creating the image, then removing it from memory  
 imagegif($image);  
 imagedestroy($image);  
 
?>

效果图片:

显示ip信息