亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么我的總是提醒打不開字體文件??好著急啊

session_start();

$image=imagecreatetruecolor(200, 60);

$color=imagecolorallocate($image, 255, 255, 255);

imagefill($image, 0, 0, $color);


$fonttype='STKAITI.TTF';

$array_font="的是了我不人在他有這個上們來到時大地為子中你說生國年

? ? 著就那和要她出也得里后自以會家可下而過天去能對小多然于心學么之都好看

? ? 起發當沒成只如事把還用第樣道想作種美總從無情己面最女但現前些所同日手又

? ? 行意動方期它頭經長兒回位分愛老因很給名法間斯知世什兩次使身者被高已親其進此話常與活正感"

;

? ? $v=str_split($array_font,3);

? ? $captch_code='';

? ? for ($i=0;$i<4;$i++){

? ? ? ? $fontsize=6;

? ? ? ?$fontcolor= imagecolorallocate($image, rand(40,160), rand(40,160), rand(40,160));


? ? ? $index = rand(0,count($v));

? ? ? $cn=$v[$index];

? ? ? $captch_code.=$cn;


? ? ? imagettftext($image, mt_rand(20,24),mt_rand(-60,60),(40*$i+20),mt_rand(30,35), $fontcolor, $fonttype, $cn);

? ? }


? ? $_SERVER['codee']=$captch_code;


? ? for($i=0;$i<200;$i++){

? ? ? ? //設定顏色

? ? ? ? $color = imagecolorallocate($image, rand(50,180), rand(50,180), rand(50,280));

? ? ? ? //坐標

? ? ? ? $x=rand(0,200);

? ? ? ? $y= rand(0,60);

? ? ? ? //系統函數imagesetpixel設定像素點

? ? ? ? imagesetpixel($image, $x, $y, $color);

? ? }

? ? for ($i=0;$i<3;$i++){

? ? ? ? $linecolor=imagecolorallocate($image, rand(80,220), rand(80,220), rand(80,220));

? ? ? ? //坐標

? ? ? ? $x1 = rand(1,99);

? ? ? ? $y1 = rand(1,59);

? ? ? ? $x2 = rand(5,200);

? ? ? ? $y2 = rand(1,59);

? ? ? ? //系統函數imageline設置劃線

? ? ? ? //也可以直接在函數imageline內設定坐標:

? ? ? ? //imageline($image,rand(8,99),rand(1,28),rand(5,99),rand(1,28)$linecolor);

? ? ? ? imageline($image, $x1, $y1, $x2, $y2, $linecolor);

? ? }



? ? header('content-type:image/png');

? ?imagepng($image);


imagedestroy($image);


正在回答

1 回答

已經找到解決辦法了:把字體文件的路徑賦值就好了,而不是字體文件的名稱
正確:$fonttype="D:\wamp64\www\project01\STKAITI.TTF"
失敗:$fonttype='STKAITI.TTF';
錯誤代碼在上文第六行

2 回復 有任何疑惑可以回復我~
#1

追覓夢初的國度

感謝你!我也是這樣的問題.
2019-04-05 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么我的總是提醒打不開字體文件??好著急啊

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號