我正在创建验证码图像,但显示错误。代码有什么问题请帮助。
session_start();
$captchanumber = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz';
//Getting first 6 word after shuffle
$captchanumber = substr(str_shuffle($captchanumber), 0, 6);
//Initializing session variable with above generated sub-string
$_SESSION["code"] = $captchanumber;
//Generating CAPTCHA
$save_url = base_path().'\resources\assets\dist\images\bj.jpg';
$image = imagecreatefromjpeg(base_path().'\resources\assets\dist\images\bj.jpg');
$foreground = imagecolorallocate($image, 175, 199, 200); //font color
imagestring($image, 5, 45, 8, $captchanumber, $foreground);
header('Content-type: image/png');
imagepng($image,$save_url);