PHP代码
  1. $str=<<
  2. GIF89a%12%00%12%00%A2%00%00%FC%FE%D4%C6%C6%C6%84%84%84%00%00%00%FF%FF%FF%00%00%00%00%00%00%00%00%00%21%F9%04%05%14%00%04%00%2C%00%00%00%00%12%00%12%00%00%03HH%B2%DC%F4%F0%09%40%2B%15%23%C2%19%3A%F0S%A6MV%40%0D%A8%B8%7D%9EY%05%AAd%7D%F4%17%2B%AC%D9%B9%F08%CF%BD%08gG%B4%F9%7E%AF%DB%90%D8R%22%93%C7%D7%CE%28%7CR%82%1B%A6V%99%EAz5%E0%B0x%ACI%00%00%3B  
  3. IMGEOF;  
  4. header("Content-Type: image/gif");  
  5. echo urldecode($str);  
  6. ?>   </li> </ol> </div> 上面代码将输出一张图片。 [attach=93]  
    PHP代码
    1. /* 
    2. $file = "watermark.gif"; 
    3.  
    4. echo base64_encode( file_get_contents($file) );*/  
    5.   
    6. $str = ‘R0lGODlhXwAcAMQAAAAAAP///+7u7t3d3czMzLu7u6qqqpmZmYiIiHd3d2ZmZlVVVURERDMzMyIiIhEREf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABAALAAAAABfABwAAAX/ICCOZGmeaKqubOu+cCzPdG3feK7vfO/fj4WD1GC4jKNGYvVQLH60RCDwEDWmVRTjMGgIBIeGN3BQGQIG1WLNbreHuQKaRAgoTAuCYDo4JOoBewglCQiGhnICh4dwD1OPkJGDOA5TBJeXAwEDmGUADQSaSyNyUwVPI4CRqwFIjlQPsbIPDg8IAZM3twQHmHuYl54it08PCZoEC2dzInULs9APdVmvtpzAVLe5NQ+/JJpwJQwOxFuBeoMLBXfNAQu9wJh/rSLVC4uHANo4ywQjCoEKDFGSKlKCdWcMtEFSyMGBAgemGDBEIAGDZ/WmXHTDZp8NgJZIbQqQoBsZERfr/yRYwOqRvxIKNKWpJ2BUxgCqVkXcNkOTnJdSSKKpUyALgEo4nUjDpaAWLSSfjgUK1OBTnQEkXm3EKUXhPVw3lLD0x+CRyZMkggZyIIUAMVkFAyFQsEeRoBLVPqFhOcnjjbFjsEQsYEJTgAICSrHKoqCiw02KA4S7WUXKSlwPGPi1wXLAnl5UrggwCkDtAtNnVk5LcmCPwj0DpPCs9kBTA5YHbt3FMbbX0lhyZh51fXjKHlvuAKxWbuqrAHBfqo7QWqcMS5dgeeMseAuksAMT7ZyaRox5FnUKpBadJqXm9CmghBVC8JUnjbEj9qwNSnhEefO3FPJFElK558BxAES0HV0Ar+CDjxz2zYAfANcRAEdENumTHIDuaJJLXQhkBoh8Ft4UTzwe5sAALyMYIAxKJfzHoIYLMECaAgcY9VyEqbyEwh8ZQoGCAxjhJeSRSCap5JJMNunkk1BGKaUNIQAAOw==’;  
    7.   
    8. header(‘content-type: image/gif’);  
    9. echo base64_decode($str);  
    10. ?>   </li> </ol> </div> 这个代码则用base64对图片进行了编码,然后输出。 结果:  [attach=94]