Execute($sql); header("Content-type: image/gif"); readfile($rs->fields[pathname].".".$rs->fields[expname]); ?> [/php] $rs->fields[pathname]是路径+文件名,$rs->fields[expname]是扩展名 为啥没法显示捏" name=description>

InfoQ

交流

讨论:如何用显示一张图片?

作者 Loading 发布于 0000-00-00 分类:php基础编程

[php]
<?php
include("../config.inc.php");
include("../include/header.inc.php");

$_GET = quotes($_GET);
$id = intval($_GET["id"]);

DBInit(); // Initalize DtaBase Connection

$sql = "select pathname,expname from $tbl[images] where id=$id";

$rs = $dbconn->Execute($sql);

header("Content-type: image/gif");
readfile($rs->fields[pathname].".".$rs->fields[expname]);
?>
[/php]
$rs->fields[pathname]是路径+文件名,$rs->fields[expname]是扩展名

为啥没法显示捏?
如果指定一个名字,比如这样
[php]
<?
header("Content-type: image/gif");
readfile("kao.gif");
?>
[/php]
就可以



逛论坛交流如何用显示一张图片?

加入书签
digg+,
reddit+,
del.icio.us+,
dzone+

4 条回复

回复

咋整啊 都好几个天了 这个问题 发表人 Loading 发表于 12月02日
readfile() 是直接读文件的吧 参数里.. 发表人 yuguanglou 发表于 12月02日
手册上说: int readfile ( string f.. 发表人 Loading 发表于 12月02日
Ding 发表人 Loading 发表于 12月02日
  1. 返回顶部

    Re: 如何用显示一张图片?

    2003年12月02日 发表人 Loading

    咋整啊
    都好几个天了 这个问题

  2. 返回顶部

    Re: 如何用显示一张图片?

    2003年12月02日 发表人 yuguanglou

    readfile()
    是直接读文件的吧 参数里面好象没有路径啊

  3. 返回顶部

    Re: 如何用显示一张图片?

    2003年12月02日 发表人 Loading

    手册上说:
    int readfile ( string filename [, bool use_include_path [, resource context]])

  4. 返回顶部

    Re: 如何用显示一张图片?

    2003年12月02日 发表人 Loading

    Ding




  5. 我有话要讲:(可以匿名发表, 发广告的有多远请滚多远!!!)

    昵称: 请输入验证码:


抢着回答

高牿龈届!

初学ORACLE 请问如何登陆SQL PLUS 用户名口令主机字符串是多少...

怎麼設定APACHE自動離線時間呢

我把Timeout設成1000000,結果還沒到1分鐘又讓你重新登錄了。我是...

中午灌水到止结束!!!

我要看书了噢。编点程序先。

请推荐一个在线网页编辑器

最好有支持各种代码的

急。在线等

请问,有那位知道 把一个页执行完以后返回到其他页?

什么意思嘛!

老一些贴里看到 PS: 正京最帅~ PS: 正京很帅~ 之类的~那个...

老萨现状

[]

利用递归把多维数组转为一维数组的函数

[php] 函数名称:array_multi2single 函数原形:array array_...

我的帖子丢了。

前天发帖:PHP 能否实现 web service ? 今天就找不到了。

Redhat8.0或RH9.0美化方案。我辛苦弄了...

美化样例。 1 http://test.5n9.com/mytop.png 2 http://d...

[]