我又來問問題了...orz
為了做驗證用的圖我開始接觸GD函數,
: 但我不知是我編的問題還是伺服器不支援(伺服器是租來的)
確定是我寫法問題
但我還是找不到錯在哪...
請問header("Content-type: image/png");
所要放的位置我明白要在一切寫入的先頭,
但我試過放在
require_once('page.inc');
require_once('db2.inc');
mysql_query("SET NAMES 'utf8'");
session_start();
的前或後都讀不到,
是我漏了什麼嗎??
以下程式碼:
<?php
require_once('page.inc');
require_once('db2.inc');
mysql_query("SET NAMES 'utf8'");
session_start();
$page = new Page();
if (isset ($_SESSION['name']))
{
$page->setCenter('您好:<br/><br/>');
$page->displayJS();
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="zh-TW">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<? echo "<script> alert('請先登入再訪問本頁面,謝謝。');
window.location.assign('http://myweb/index.php'); </script>" ;
}
header("Content-type: image/png");
$im = @imagecreate(100, 50)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
先在這裡謝過各位大德<(_ _)>
--
PSO2 :Rita/Ship 07ギョーフ
ハンター:Lv 03 /レンジャー:Lv 07/フォース:Lv 01
FF XIV :Rita Ngs/Masamune
劍10/鬥50/斧28/槍50/弓11/幻06/咒21
木17/鍛01/板05/彫01/革07/裁01/鍊01/調10/採11/園28/漁04
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.202.9.7
→
09/20 19:06, , 1F
09/20 19:06, 1F
→
09/20 19:07, , 2F
09/20 19:07, 2F
→
09/20 19:18, , 3F
09/20 19:18, 3F
→
09/20 21:52, , 4F
09/20 21:52, 4F
→
09/21 02:19, , 5F
09/21 02:19, 5F
→
09/21 02:20, , 6F
09/21 02:20, 6F
→
09/21 02:21, , 7F
09/21 02:21, 7F
→
09/21 06:50, , 8F
09/21 06:50, 8F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章