課程
/后端開發
/PHP
/PHP實現驗證碼制作
我是按照老師的步驟寫的,效果也都實現了,但是覺得字號有點小,于是我就把字號給調大了,但是沒有反應,和變大之前的字號是一樣的,也就是說,我所設置的字號無效。這點不是很理解
2016-07-25
源自:PHP實現驗證碼制作 1-4
正在回答
http://php.net/manual/zh/function.imagestring.php?這里font只用1--5 最大就是5了 如果你想要更大的話可以使用imagettftext:array ImageTTFText(int im, int size, int angle, int x, int y, int col, string fontfile, string text); 參數分別為 image,字體大小,角度 0代表水平,顏色,字體文件名 這里可以引用字體文件,內容。
示例:?
? ? $fontcontent=rand(0,9);
? ? $fontcolor=imagecolorallocate($image, rand(0,120), rand(0,120), rand(0,120));
? ? $x=($i*100/4)+rand(5,10);
? ? $y=rand(15,30);
? ?imagettftext($image, 20, 0, $x, $y, $fontcolor ,'../fonts/BebasNeue-webfont.ttf', $fontcontent);
查手冊或者百度
舉報
各種形態驗證碼核心原理與實現技巧,講解實現過程中的技術難點
2 回答關于漢字驗證碼的問題
3 回答驗證碼字體大小
2 回答字母數字混合驗證碼
1 回答驗證碼刷新問題
1 回答驗證碼的驗證策劃
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-08-01
http://php.net/manual/zh/function.imagestring.php?這里font只用1--5 最大就是5了 如果你想要更大的話可以使用imagettftext:array ImageTTFText(int im, int size, int angle, int x, int y, int col, string fontfile, string text); 參數分別為 image,字體大小,角度 0代表水平,顏色,字體文件名 這里可以引用字體文件,內容。
示例:?
? ? $fontcontent=rand(0,9);
? ? $fontcolor=imagecolorallocate($image, rand(0,120), rand(0,120), rand(0,120));
? ? $x=($i*100/4)+rand(5,10);
? ? $y=rand(15,30);
? ?imagettftext($image, 20, 0, $x, $y, $fontcolor ,'../fonts/BebasNeue-webfont.ttf', $fontcontent);
2016-07-27
查手冊或者百度