gpt4 book ai didi

php - 基于 URL ID 加载图像

转载 作者:太空宇宙 更新时间:2023-11-03 10:58:50 25 4
gpt4 key购买 nike

我正在尝试根据 URL 中的 ID 加载图像:

例如:www.exampleurl.com/API/upload/1.jpg 包含一张图片。

当我访问 www.exampleurl.com/photo/index.php?id=1 时,我试图将该图像加载到单独的 PHP 文件中

到目前为止,我的代码似乎不起作用:

<!DOCTYPE html> 
<html>
<head>
</head>
<body>
<?php
intval($_GET['id']);
?>
<h1> <center> This is the image: </center> </h1>
<img src="http://exampleurl.com/API/upload/<?php echo $id;?>.jpg" alt="some_text">
</body>
</html>

如有任何帮助,我们将不胜感激。

最佳答案

    <!DOCTYPE html> 
<html>
<head>
</head>
<body>
<?php
$id = intval($_GET['id']);
?>
<h1> <center> This is the image: </center> </h1>
<img src="http://exampleurl.com/API/upload/<?php echo $id;?>.jpg" alt="some_text">
</body>
</html>

你必须指定 $id

关于php - 基于 URL ID 加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17796499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com