驗證碼不能得到
<?php require_once?'string.fuc.php'; $width?=?90; $height?=?30; $image?=?imagecreatetruecolor($width,?$height);?//?創建畫布 $white?=?imagecolorallocate($image,?255,?255,?255);?//?設置顏色 $black?=?imagecolorallocate($image,?0,?0,?0); //?填充一個矩形填充畫布 imagefilledrectangle($image,?1,?1,?$width?-?2,?$height?-?2,?$white); /*header("content-type:image/gif"); imagegif($image); imagedestroy($image);*/ $type=2; $length=5; $chars?=?buildRondString($type,$length); //echo?$chars; imagettftext($image,?20,?0,?10,?20,?$black,?"simhei.ttf",?$chars); header("content-type:image/png"); imagepng($image); imagedestroy($image);
單獨的輸出上面的畫布和個那個隨機字符串都能得到?? 但加上imagettftext()后個看不到圖片了? 這是為什么
2014-11-16
你要確定下你項目中是否有這個字體文件,如果沒有會報錯,圖片就顯示不出來了
^-^...