我正在从事一个项目PHP
。尝试从查询字符串中加载图像 =><img src="load_image.php?name=Profile_Photo_Small" />
有人知道怎么做吗?
在load_image.php
文件内部,您需要返回带有合格标头的文件。就像是:
$filename = __DIR__ . '/images/' . $_GET['name'] . '.jpg';
header('Content-Type: image/jpeg');
readfile($filename);
我还应该警告您直接在代码中使用查询字符串参数。您需要清理输入数据。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句