可能重複:
Does html can be use with dynamic generated images in php?無法顯示圖像,因爲它包含錯誤PHP的
我試圖生成PHP驗證碼。我相信我的代碼的權利,但我沒能獲得在browser..this圖像是代碼:
<!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>Untitled Document</title>
</head>
<body>
<?php header('Content-type: image/png');?>
<?php session_start();
$md5 = md5(microtime() * time());
$string = substr($md5, -5);
$captcha = imagecreatefrompng("./captcha.png");
$black = imagecolorallocate($captcha, 0, 0, 0);
$line = imagecolorallocate($captcha,233,239,239);
imageline($captcha,0,0,39,29,$line);
imageline($captcha,40,0,64,29,$line);
$_SESSION['key'] = md5($string);
imagestring($captcha, 5, 20, 10, $string, $black);
imagepng($captcha);?>
</body>
</html>
PNG圖像是在同一文件夾中的代碼。在GD選項在php..I啓用clueless..any幫助表示讚賞...謝謝
這些輸入代碼是什麼? – GolezTrol