php creates graphic garbled code

藏色散人
Release: 2023-02-27 06:16:01
Original
2288 people have browsed it

php creates graphic garbled code

#php creates graphics garbled?

Problematic code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php学习</title>
</head>
<body>
<?php 
$im=imagecreate(200,200);  //创建一个画布(单位像素pixel)
$white=imagecolorallocate($im,225,66,159); //设置画布的背景颜色为粉色 (256RGB)
imagegif($im);  //输出gif图像
imagedestroy($im); 
?> 
</body>
</html>
Copy after login

Running result:

php creates graphic garbled code

Modified code:

<?php 
$im=imagecreate(200,200); //创建一个画布(单位像素pixel)
$white=imagecolorallocate($im,225,66,159); //设置画布的背景颜色为粉色 (256RGB)
header(&#39;content-type:image/gif&#39;);  //设置gif Image
imagegif($im); //输出gif图像
imagedestroy($im); 
?>
Copy after login

Running results:

php creates graphic garbled code

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php creates graphic garbled code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template