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

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

按照老師的步驟還是顯示不了驗證碼!

按照老師的步驟還是顯示不了驗證碼!還有老師哪些login、main、index、的PHP都是要自己打上?那些能用靜態網站編輯嗎?

正在回答

6 回答

字體加載的問題!我這樣寫的時候,很多時候會加載不了驗證碼,有時可以顯示

$fontfiles = array(

? ? ? ? "SIMYOU.TTF",

? ? ? ? "MSYHL.TTC",

? ? ? ? "MSYH.TTC"

? );

后來我這樣寫就不會出現一時有,一時沒有的情況

$fontfiles = array(

? ? ? ? "MSYH.TTC"

? ? );





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

一進酒吧就變壞l 提問者

應該是顯示驗證碼之前要清理緩存。已經能顯示了
2016-04-05 回復 有任何疑惑可以回復我~

我的解決方法是:

56d57b3d0001f31605000305.jpg

這樣就可以顯示了,因為是新手,感覺應該是路徑問題


0 回復 有任何疑惑可以回復我~

和我一樣的問題,換了360瀏覽器,谷歌瀏覽器,火狐都是這樣

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

一進酒吧就變壞l 提問者

那就是要在Chrome瀏覽器上才能顯示?那這樣是代碼的問題嗎?
2016-02-23 回復 有任何疑惑可以回復我~

http://img1.sycdn.imooc.com//56c61a7200018faf05820110.jpg我這邊是顯示這樣的。不知道什么問題。麻煩老師幫忙解決一下?。。≈x謝

0 回復 有任何疑惑可以回復我~

<?php
//通過GD庫做驗證碼
//引用字符串類 得到隨機字符串


require_once 'string.func.php';
function verifyimage($type, $length, $line, $pixel, $width, $height) {
?? ?
?? ?$chars = buildRandomString ( $type, $length );
?? ?$_SESSION ["verify1"] = $chars;
?? ?
?? ?//驗證碼圖片的寬高
?? ?//創建畫布
?? ?$image = imagecreatetruecolor ( $width, $height );
?? ?$white = imagecolorallocate ( $image, 255, 255, 255 );
?? ?//填充矩形畫布
?? ?imagefilledrectangle ( $image, 1, 1, $width - 2, $height - 2, $white );
?? ?
?? ?//輸出字符 每個字的顏色不一樣怎么辦?
?? ?//由于字體的原因找成有的時候沒有數字,請注意
?? ?$fontfiles = array ("batang.ttc", "calibri.ttf" );
?? ?for($j = 0; $j < $length; $j ++) {
?? ??? ?$size = mt_rand ( 14, 18 );
?? ??? ?$angle = mt_rand ( - 15, 15 );
?? ??? ?$x = 5 + $j * $size;
?? ??? ?$y = mt_rand ( 20, 26 );
?? ??? ?$color = imagecolorallocate ( $image, mt_rand ( 50, 90 ), mt_rand ( 80, 200 ), mt_rand ( 90, 180 ) );
?? ??? ?$fontfile = "../font/" . $fontfiles [mt_rand ( 0, count ( $fontfiles ) - 1 )];
?? ??? ?
?? ??? ?$text = substr ( $chars, $j, 1 );
?? ??? ?imagettftext ( $image, $size, $angle, $x, $y, $color, $fontfile, $text );
?? ?}
?? ?//加干擾點
?? ?

?? ?if ($pixel) {
?? ??? ?$color = imagecolorallocate ( $image, mt_rand ( 0, 255 ), mt_rand ( 0, 255 ), mt_rand ( 0, 255 ) );
?? ??? ?for($i = 0; $i < $pixel; $i ++) {
?? ??? ??? ?imagesetpixel ( $image, mt_rand ( 0, $width ), mt_rand ( 0, $height ), $color );
?? ??? ?}
?? ?}
?? ?//加干擾線
?? ?

?? ?if ($line) {
?? ??? ?for($i = 0; $i < $line; $i ++) {
?? ??? ??? ?$color = imagecolorallocate ( $image, mt_rand ( 0, 255 ), mt_rand ( 0, 255 ), mt_rand ( 0, 255 ) );
?? ??? ??? ?imageline ( $image, mt_rand ( 0, $width ), mt_rand ( 0, $height ), mt_rand ( 0, $width ), mt_rand ( 0, $height ), $color );
?? ??? ?}
?? ?}
?? ?//聲明輸出圖片的格式
?? ? @header ( "Content-Type:image/png" );
?? ?//輸出圖片
?? ?imagepng ( $image );
?? ?//銷毀圖片資源
?? ?imagedestroy ( $image );
}


php文件都是編輯工具自動生成的

0 回復 有任何疑惑可以回復我~

<?php
//通過GD庫做驗證碼
//引用字符串類 得到隨機字符串


require_once 'string.func.php';
function verifyimage($type, $length, $line, $pixel, $width, $height) {
?? ?
?? ?$chars = buildRandomString ( $type, $length );
?? ?$_SESSION ["verify1"] = $chars;
?? ?
?? ?//驗證碼圖片的寬高
?? ?//創建畫布
?? ?$image = imagecreatetruecolor ( $width, $height );
?? ?$white = imagecolorallocate ( $image, 255, 255, 255 );
?? ?//填充矩形畫布
?? ?imagefilledrectangle ( $image, 1, 1, $width - 2, $height - 2, $white );
?? ?
?? ?//輸出字符 每個字的顏色不一樣怎么辦?
?? ?//由于字體的原因找成有的時候沒有數字,請注意
?? ?$fontfiles = array ("batang.ttc", "calibri.ttf" );
?? ?for($j = 0; $j < $length; $j ++) {
?? ??? ?$size = mt_rand ( 14, 18 );
?? ??? ?$angle = mt_rand ( - 15, 15 );
?? ??? ?$x = 5 + $j * $size;
?? ??? ?$y = mt_rand ( 20, 26 );
?? ??? ?$color = imagecolorallocate ( $image, mt_rand ( 50, 90 ), mt_rand ( 80, 200 ), mt_rand ( 90, 180 ) );
?? ??? ?$fontfile = "../font/" . $fontfiles [mt_rand ( 0, count ( $fontfiles ) - 1 )];
?? ??? ?
?? ??? ?$text = substr ( $chars, $j, 1 );
?? ??? ?imagettftext ( $image, $size, $angle, $x, $y, $color, $fontfile, $text );
?? ?}
?? ?//加干擾點
?? ?

?? ?if ($pixel) {
?? ??? ?$color = imagecolorallocate ( $image, mt_rand ( 0, 255 ), mt_rand ( 0, 255 ), mt_rand ( 0, 255 ) );
?? ??? ?for($i = 0; $i < $pixel; $i ++) {
?? ??? ??? ?imagesetpixel ( $image, mt_rand ( 0, $width ), mt_rand ( 0, $height ), $color );
?? ??? ?}
?? ?}
?? ?//加干擾線
?? ?

?? ?if ($line) {
?? ??? ?for($i = 0; $i < $line; $i ++) {
?? ??? ??? ?$color = imagecolorallocate ( $image, mt_rand ( 0, 255 ), mt_rand ( 0, 255 ), mt_rand ( 0, 255 ) );
?? ??? ??? ?imageline ( $image, mt_rand ( 0, $width ), mt_rand ( 0, $height ), mt_rand ( 0, $width ), mt_rand ( 0, $height ), $color );
?? ??? ?}
?? ?}
?? ?//聲明輸出圖片的格式
?? ? @header ( "Content-Type:image/png" );
?? ?//輸出圖片
?? ?imagepng ( $image );
?? ?//銷毀圖片資源
?? ?imagedestroy ( $image );
}


php文件都是編輯工具自動生成的

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

一進酒吧就變壞l 提問者

還是解決不了問題。。顯示的驗證碼是破裂的圖片
2016-02-19 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
手把手教你實現電商網站后臺開發
  • 參與學習       117253    人
  • 解答問題       2101    個

手把手教你用PHP搭建電子商務平臺,由淺入深教你搭建電商系統

進入課程

按照老師的步驟還是顯示不了驗證碼!

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

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

幫助反饋 APP下載

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

公眾號

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