gpt4 book ai didi

php - 在php代码中添加mysql查询项

转载 作者:行者123 更新时间:2023-11-29 23:27:50 25 4
gpt4 key购买 nike

我正在使用下面的代码来运行灯箱功能。它工作正常,但我需要更改 - lightbox_display('properties/593/', 'lightbox[gallery]'); 的最后一行以使用 $propertyimagefolder 而不是 593。我尝试了 lightbox_display('properties/$propertyimagefolder/', 'lightbox[gallery]'); 但没有运气。谁能帮忙解决这个问题吗?

$propertyimagefolder = $row['Reference_No'];

function lightbox_display($dir_to_search, $rel){
$image_dir = $dir_to_search;
$dir_to_search = scandir($dir_to_search);
$image_exts = array('gif', 'jpg', 'jpeg', 'png');
$excluded_filename = '_t';

foreach ($dir_to_search as $image_file){
$dot = strrpos($image_file, '.');
$filename = substr($image_file, 0, $dot);
$filetype = substr($image_file, $dot+1);
$thumbnail_file = strrpos($filename, $excluded_filename);
if ((!$thumbnail_file) and array_search($filetype, $image_exts) !== false){

echo "<a href='../../".$image_dir.$image_file."' rel='".$rel."'><img src='../../".$image_dir.$filename.".".$filetype."' alt='".$filename."' width='100' height='80' title=''/></a>"."\n";

}
}
}

lightbox_display('properties/593/', 'lightbox[gallery]');

最佳答案

PHP 不处理单引号中的变量字符串。只需替换为双引号即可:

lightbox_display("properties/$propertyimagefolder/", 'lightbox[画廊]');

或者连接变量和字符串:

lightbox_display('properties/' . $propertyimagefolder . '/', 'lightbox[gallery]');

关于php - 在php代码中添加mysql查询项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26818709/

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