<?php
/**
* Created by PhpStorm.
*/
$my_image = Imagecreate(300,300);
$white = imagecolorallocate($my_image,255,255,255); //第一个颜色作为背景色
$red = imagecolorallocate($my_image,255,0,0);
$blue = imagecolorallocate($my_image,0,0,255);
$black = imagecolorallocate($my_image,0,0,0);
imagerectangle($my_image,15,15,95,155,$red);
imagerectangle($my_image,95,155,175,295,$blue);
imagerectangle($my_image,175,15,255,155,$black);
header("Content-type:image/png");
imagepng($my_image);
imagedestroy($my_image);