[請益] 驗證碼圖案跑不出來

看板PHP作者 (frog)時間13年前 (2012/08/23 15:33), 編輯推噓2(204)
留言6則, 5人參與, 最新討論串1/3 (看更多)
html: <img src="captcha.php" id="captcha" alt="captcha" /> php: <?session_start();?> <?php create_image(); exit(); function create_image(){ $security_code =$_SESSION["security_code"]; $image = @imagecreatefromjpeg("images\static.jpg"); $black = ImageColorAllocate($image, 0, 0, 0); $vPos = 4; $hPos = 30; $fontSize = 5; ImageString($image, $fontSize, $hPos, $vPos, $security_code, $black); header("Content-Type: image/jpeg"); ImageJpeg($image); ImageDestroy($image); } ?> 想請問為什麼一直跑不出圖片呢@@ php所要引用的圖片也有放對位置 懇求幫忙解答... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.163.194.235

08/23 15:59, , 1F
GD有安裝麼?
08/23 15:59, 1F

08/23 16:06, , 2F
有 有安裝
08/23 16:06, 2F

08/23 17:52, , 3F
先註解掉 header("Content-Type: image/jpeg");
08/23 17:52, 3F

08/23 17:52, , 4F
然後拿掉@,看看有沒有錯誤產生
08/23 17:52, 4F

08/23 20:28, , 5F
為什麼要特別寫一個funtion再呼叫?另外<?改成<?php
08/23 20:28, 5F

08/23 21:06, , 6F
應該是: "images\static.jpg" 路徑要用 / 斜線啦! ^^
08/23 21:06, 6F
文章代碼(AID): #1GDTpVB9 (PHP)
文章代碼(AID): #1GDTpVB9 (PHP)