PHP development verification code tutorial: Create canvas and output
In the previous chapter, when we created the canvas, we wrote the width and height of the image directly in the function, which would be more troublesome to modify.
Let's look at the following piece of code:
<?php
//创建一个画布
$width = 85;
$height = 30;
$img = imagecreatetruecolor($width, $height);
//输出图像
header("content-type:image/png");
imagepng($img);
//销毁资源
imagedestroy($img);
?>With the above code, we can also output a canvas with a black background, width 85, and height 30
new file
<?php
//创建一个画布
$width = 85;
$height = 30;
$img = imagecreatetruecolor($width, $height);
//输出图像
header("content-type:image/png");
imagepng($img);
//销毁资源
imagedestroy($img);
?>
Preview
Clear
Students who have watched this course are also learning
Let's briefly talk about starting a business in PHP
Quick introduction to web front-end development
Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
Login verification and classic message board
Computer network knowledge collection
Quick Start Node.JS Full Version
The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)
















The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~ 