所以我一直在做一个homelab仪表板,我需要知道如何在显示我的php数组后添加一个响应式的“显示更多”按钮。我对开发相当陌生,而且更像是一种爱好。以下是我目前如何设置它,但是如果我在torrent数组中有超过15个项目,它会变得冗长。任何的意见都将会有帮助。查看更多按钮为php阵列
<div class="row">
<!--Downloading Section-->
<div class="col-lg-6 col-md-3 col-sm-12 col-xs-12">
<div class="info-box blue-bg">
<h3>Downloading <span class="speeds">
<?php
if ($client == "qbittorent"){
echo round(intval($global_info['dl_info_speed'])/1000, 2) . " kB/s";
} elseif ($client == "transmission"){
echo round(intval($global_info['downloadSpeed'])/1000, 2) . " kB/s";
}
?>
</span></h3>
<?php
if($torrents == null){
echo "There was a problem fetching torrents.";
} else {
if ($client == "qbittorrent"){
foreach($torrents as $torrent){
if($torrent['state'] == "downloading"){
echo $torrent['name'] . "<br>";
}
}
} elseif ($client == "transmission"){
foreach($torrents['torrents'] as $torrent){
if($torrent['status'] == "4"){
echo $torrent['name'] . "<br>";
}
}
}
}
?>
</div><!--/.info-box-->
</div><!--/.col-->
你可以用CSS隐藏输出,并添加一个按钮,该按钮对JavaScript做出反应以放大隐藏的部分。 –