$imagefilename=$row['uimage'];
即将图片的网址从表存储到变量imagefilename
现在我希望使用该文件名并通过使用命令
从其位置获取图像 echo '<a href="update/update.php"><img id="unregistered" src="php/customer/customer_images/{$imagefilename}"/></a>';
但是它不考虑将“ $ imagefilename”作为URL的一部分,所以有人可以告诉我如何实现此目标!
答案 0 :(得分:2)
使用单引号将php变量附加如下:
echo '<a href="update/update.php"><img id="unregistered" src="php/customer/customer_images/'.$imagefilename.'/></a>';
答案 1 :(得分:0)
请尝试
<?php
$imagefilename = "file1.jpg";
echo '<a href="update/update.php"><img id="unregistered" src="php/customer/customer_images/'.$imagefilename.'/></a>';
echo "\n";
echo "OR";
echo "\n";
$imagefilename = "php/customer/customer_images/file1.jpg";
echo "https://localhost/folderName/update/update.php?$imagefilename";
?>
答案 2 :(得分:0)
将所有评论合并在一个答案中
//Your image url
$var = 'my%20text';
// echo with ' and urldecode
echo 'sometext '.urldecode($var).' someothertext';
//lambda function with urldecode
$myfunc = function($text) {
echo urldecode($text);
};
// working echo with {} (needs lambda function)
echo "somtext{$myfunc($var)}";