一个php文件作为img src [英] A php file as img src

查看:169
本文介绍了一个php文件作为img src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用img标签打印图像,其中src是一个php文件,该脚本还将在服务器scirpt处理一些操作。任何人都有示例代码吗?

i want to print a image by using a img tag which src is a php file, the script will also process some action at server scirpt. Anyone have an example code?

这是我的测试代码但没有影响

here is my test code but no effect

img.html

<img src="visitImg.php" />

visitImg.php

visitImg.php

<?

header('Content-Type: image/jpeg');

echo "<img src=\"btn_search_eng.jpg\" />";

?>


推荐答案

使用 readfile

<?php
header('Content-Type: image/jpeg');
readfile('btn_search_eng.jpg');
?>

这篇关于一个php文件作为img src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆