问题是我找不到从每个 获-6ren">
gpt4 book ai didi

javascript - 点击回显属性

转载 作者:行者123 更新时间:2023-11-28 04:47:20 26 4
gpt4 key购买 nike

我正在尝试创建一个画廊,它使用 PHP 来浏览 Assets 文件夹并充当相册系统。下面的代码将文件作为相册检索:

<?php
include_once("../PhpScript/RetAlbInfo.php");
$files = array_slice(scandir('../Assets/Gallery/'), 2);
for($albflcnt = 0;$albflcnt<count($files);$albflcnt++){
echo "<div style='...'><div class='albm' style='...' onmousedown='gotoalbum();albnm();'></div><p style='...'>".$files[$albflcnt]."</p></div>";
}
?>

问题是我找不到从每个 <p> 获取文件夹名称的方法标记并将其附加到 url 中,以便显示其子文件夹。

最佳答案

您可以使用glob()使用 GLOB_ONLYDIR 选项

<?php
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
?>

<?php 
$dirs = array_filter(glob('*'), 'is_dir');
print_r( $dirs);

?>

关于javascript - 点击回显属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43240485/

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