第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

圖片出不來

就是圖片出不來,求大神指點,急求http://img1.sycdn.imooc.com//57404d170001050205170327.jpg

這是我的代碼

<?php
???? ?
??? session_start();
???? ?
??? $image=imagecreatetruecolor(100,30);//創(chuàng)建一個寬100,高30的圖片
?? $bgcolor=imagecolorallocate($image,255,255,255);
??? imagefill($image,0,0,$bgcolor);//將白色$bgcolor填充底圖,從左上角填充到右上角
?? ?
?/*? ?
???? for($i=0;$i<4;$i++) //增加數(shù)字
???? {??????????? ?
???? $fontsize=6;//定義數(shù)字的字體大小
???? $fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));//在這張圖片資源上申請一個顏色,就是數(shù)字的顏色
???? $fontcontent=rand(0,9);//數(shù)字的內容,隨機生成0-9
????? $x=($i*100/4)+rand(5,10);//坐標來標識隨機數(shù)字寫在哪里
????? $y=rand(5,10);
???? imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);//在$image的圖像資源上,畫隨機數(shù)字
??? }
*/
? $captch_code='';
?? for($i=0;$i<4;$i++)//增加字母和數(shù)字
{
????? $fontsize=6;
????? $fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));
???? ?

????? $data='abcdefghijkmnpqrstuvwxyz23456789';
????? $fontcontent=substr($data,rand(0,strlen($data)),1);
????? ?
?????? $captch_code.=$fontcontent;?? //將生成的內容加入到空字符$captch_code中
???? ?
?????? $x=($i*100/4)+rand(5,10);
?????? $y=rand(5,10);
???? imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);
??? }
? $_SESSION['authcode']=$captch_code;



? for($i=0;$i<200;$i++)//增加200個以內的隨機點
{
???? $pointcolor=imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200));//生成點的顏色
???? imagesetpixel($image,rand(1,99),rand(1,29),$pointcolor);//
}
for($i=0;$i<3;$i++)//增加線
{
???? $linecolor=imagecolorallocate($image,rand(80,220),rand(80,220),rand(80,220));
???? imageline($image,rand(1,99),rand(1,29),rand(1,99),rand(1,29),$linecolor);
}
???? header('content-type: image/png');//表明輸出內容的格式
??? imagepng($image);//輸出&image
//end
? imagedestroy($image);//銷毀&image
?>



<?php
?header("content-type:text/html;charset=gb2312");
?if(isset($_REQUEST['authcode'])){
?session_start();
?if(strtolower($_REQUEST['authcode'])==$_SESSION['authcode']){
?echo '<font color="#0000CC">輸入正確</font>';
?}else{
?echo '<font color="#CC0000"><b>輸入錯誤</b></font>';
?}
?exit();
?}
?>


<!DOCTYPE html>
<html>
?? <head>
????? <meta charset="utf-8" />
?????? <title>確認驗證碼</title>
? </head>
? <body>
?????? <form method="post" action="./form.php">
?????????? <p>驗證碼圖片: <img border="1" src="./captcha.php?r=<?php echo rand();?>" width="100px" height="30px"></p>
?????????? <p>請輸入圖片中的內容: <input type="text" name="authcode" value=""/></p>
?????????? <p><input type="submit" value="提交"? style="padding:6px 20px;"></p>
?????? </form>
? </body>
</html>
????

正在回答

3 回答

我,加了? 換一個? 以后又出不來了

應該只是form改了一點吧,我看不出,你再幫我看看白,兩個都貼上好了

<?php
???? ?
??? session_start();
???? ?
??? $image=imagecreatetruecolor(100,30);//創(chuàng)建一個寬100,高30的圖片
?? $bgcolor=imagecolorallocate($image,255,255,255);
??? imagefill($image,0,0,$bgcolor);//將白色$bgcolor填充底圖,從左上角填充到右上角
?? ?
?/*? ?
???? for($i=0;$i<4;$i++) //增加數(shù)字
???? {??????????? ?
???? $fontsize=6;//定義數(shù)字的字體大小
???? $fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));//在這張圖片資源上申請一個顏色,就是數(shù)字的顏色
???? $fontcontent=rand(0,9);//數(shù)字的內容,隨機生成0-9
????? $x=($i*100/4)+rand(5,10);//坐標來標識隨機數(shù)字寫在哪里
????? $y=rand(5,10);
???? imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);//在$image的圖像資源上,畫隨機數(shù)字
??? }
*/
? $captch_code='';
?? for($i=0;$i<4;$i++)//增加字母和數(shù)字
{
????? $fontsize=6;
????? $fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));
???? ?

????? $data='abcdefghijkmnpqrstuvwxyz23456789';
????? $fontcontent=substr($data,rand(0,strlen($data)),1);
????? ?
?????? $captch_code.=$fontcontent;?? //將生成的內容加入到空字符$captch_code中
???? ?
?????? $x=($i*100/4)+rand(5,10);
?????? $y=rand(5,10);
???? imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);
??? }
? $_SESSION['authcode']=$captch_code;



? for($i=0;$i<200;$i++)//增加200個以內的隨機點
{
???? $pointcolor=imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200));//生成點的顏色
???? imagesetpixel($image,rand(1,99),rand(1,29),$pointcolor);//
}
for($i=0;$i<3;$i++)//增加線
{
???? $linecolor=imagecolorallocate($image,rand(80,220),rand(80,220),rand(80,220));
???? imageline($image,rand(1,99),rand(1,29),rand(1,99),rand(1,29),$linecolor);
}
???? header('content-type: image/png');//表明輸出內容的格式
??? imagepng($image);//輸出&image
//end
? imagedestroy($image);//銷毀&image
?>


<?php
?header("content-type:text/html;charset=gb2312");
?if(isset($_REQUEST['authcode'])){
?session_start();
?if(strtolower($_REQUEST['authcode'])==$_SESSION['authcode']){
?echo '<font color="#0000CC">輸入正確</font>';
?}else{
?echo '<font color="#CC0000"><b>輸入錯誤</b></font>';
?}
?exit();
?}
?>


<!DOCTYPE html>
<html>
?? <head>
????? <meta charset="utf-8" />
?????? <title>確認驗證碼</title>
? </head>
? <body>
?????? <form method="post" action="./form.php">
?????????? <p>
???????????? 驗證碼圖片:
???????????? <img id="captcha_img" border="1" src="./captcha.php?r=<?php echo rand();?>" width="100" height="30"/>
???????????? <a href="javascript:void(0)" onclick="document.getElementById('captcha_img').src='./captcha.php?r='+Math.random()">換一個?</a>
?????????? </p>
?????????? <p>請輸入圖片中的內容: <input type="text" name="authcode" value=""/></p>
?????????? <p><input type="submit" value="提交"? style="padding:6px 20px;"></p>
?????? </form>
? </body>
</html>
????

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

ok~~~不用謝


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

http://img1.sycdn.imooc.com//574450bc0001275f04280158.jpg



你好,整篇看下來,說實話沒看出來,

我就未經(jīng)你的允許吧你的代碼完全拷貝到我的文件中去現(xiàn)地做實驗,是可以生成出圖片的

我估計是不是你的文件存儲編碼格式有差別,首先說明,我將你的代碼拷貝后,所有文件的編碼格式都是utf-8的,最終都生成出來了圖片,你自己檢查一下。

同時,我把所有文件都存為utf-8后,我將

<?php
?header("content-type:text/html;charset=gb2312");
?if(isset($_REQUEST['authcode'])){

加粗地方也改成了utf-8,不然我這里顯示亂碼。


ps:

????<p>驗證碼圖片: <img border="1" src="./captcha.php?r=<?php echo rand();?>" width="100px" height="30px"></p>

請問我加粗的地方,你為什么要加這一段代碼?我有點沒看懂,

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

notmatter 提問者

其實,我兩天之后,又打開運行就可以出來圖片了,,,,所以,原來是我網(wǎng)速的問題,sorry啊,那個編碼方式,我的utf-8是出不來的,我的適合GB2312,下面加粗那里,是代表隨機獲得,我是看著視頻敲的,不是很清楚。謝謝你啊
2016-05-27 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
PHP實現(xiàn)驗證碼制作
  • 參與學習       37928    人
  • 解答問題       331    個

各種形態(tài)驗證碼核心原理與實現(xiàn)技巧,講解實現(xiàn)過程中的技術難點

進入課程

圖片出不來

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

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號