PHP中如何通过关联数组在一个变量中传递两个值
我使用的是UberGallery.php 对于每个图像弹出窗口,从UberGallery.php获取的图像底部都会显示图像名称(例如4488826 6f061c99ec b d)PHP中如何通过关联数组在一个变量中传递两个值,php,arrays,csv,associative-array,Php,Arrays,Csv,Associative Array,我使用的是UberGallery.php 对于每个图像弹出窗口,从UberGallery.php获取的图像底部都会显示图像名称(例如4488826 6f061c99ec b d) // Loop through array and add additional info foreach ($dirArray as $key => $image) { // Get files relative path
// Loop through array and add additional info
foreach ($dirArray as $key => $image) {
// Get files relative path
$relativePath = $this->_rImgDir . '/' . $key;
$galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array(
'file_title' => str_replace('_', ' ', pathinfo($image['real_path'], PATHINFO_FILENAME)),
'file_path' => htmlentities($relativePath),
'thumb_path' => $this->_createThumbnail($image['real_path'])
);
}
上述代码中的文件标题正在影响要更改的标题。在defaultGallery.php中显示的图像如下所示
<?php if (!empty($images) && $stats['total_images'] > 0): ?>
<ul id="galleryList" class="clearfix">
<?php foreach ($images as $image): ?>
<li><a href="<?php echo html_entity_decode($image['file_path']); ?>" title="<?php echo $image['file_title']; ?>" rel="<?php echo $relText; ?>"><img src="<?php echo $image['thumb_path']; ?>" alt="<?php echo $image['file_title']; ?>"/></a></li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p>No images found.</p>
<?php endif; ?>
我应该如何将姓名和电子邮件传递到上述文件\u title以获得所需结果?
还是有其他方法可以做到这一点
请帮我找出解决办法。像这样试试这个
$galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array(
'file_title' => ' ',
'file_path' => htmlentities($relativePath),
'thumb_path' => $this->_createThumbnail($image['real_path'])
);
如果我们保持文件标题为空,则不会显示任何内容。我想显示我在问题中提到的两个字段。@priya786:你知道我该怎么做吗?你想用名称和电子邮件来代替titleyaah,我想用图像名称和电子邮件更改图像弹出窗口底部的标题(请查看我提供的链接演示)。我正在尝试从csv文件中获取并在那里显示。但是你做不到。@priya786:你的回答还不够OP的要求。
$galleryArray['images'][htmlentities(pathinfo($image['real_path'], PATHINFO_BASENAME))] = array(
'file_title' => ' ',
'file_path' => htmlentities($relativePath),
'thumb_path' => $this->_createThumbnail($image['real_path'])
);