我正在从事一个项目PHP。尝试从查询字符串中加载图像 =><img src="load_image.php?name=Profile_Photo_Small" />有人知道怎么做吗?
1 回答
慕工程0101907
TA贡献1887条经验 获得超5个赞
在load_image.php文件内部,您需要返回带有合格标题的文件。就像是:
$filename = __DIR__ . '/images/' . $_GET['name'] . '.jpg';
header('Content-Type: image/jpeg');
readfile($filename);
我还应该警告您直接在代码中使用查询字符串参数。您需要清理输入数据。
- 1 回答
- 0 关注
- 212 浏览
添加回答
举报
0/150
提交
取消