gpt4 book ai didi

PHP Codeigniter foreach 崩溃

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

我想在我的 php.ini 中实现这种崩溃。这是一个例子:

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<a data-toggle="collapse" href="#collapse1">Heading</a>
<div id="collapse1">
<a data-toggle="collapse" href="#collapse2">
Category
</a>
</div>
<div id="collapse2">Items</div>

我想在这里应用类似的东西:

<?php
$i=1;foreach($itemlist as $value) {
echo "<h3>Tower Type : ".$value['notower']."</h3><br>";

foreach($value['items'] as $val) { ?>
<?= "<h4>".$val['groupem']."</h4><br>"; ?>
<table class ="table table-bordered table-hovered table-striped table-condensed">
<thead>
<th><?= "Item Name" ?></th>
<th><?= "Value" ?>
</thead>
<tbody>
<?php foreach($val['item'] as $v) :?>
<tr>
<td><?= $v['nm_detailem']?></td>
<td><?= $v['em_value']?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php } ?>

<?php } ?>

我该怎么做?我被困在放那些 href 的地方。

最佳答案

您可以使用以下内容:

$sOutput = '';
foreach ( $aData as $sData){

If($sOutput != ''){
$sOutput .= '</div><div class="collapse hidden">';
}
$sOutput .= '<a href=""></a>';
}

If(count($sOutput) == 1 && $sOutput !== ''){$sOutput .= '</div>';}

添加到 CSS:

.hidden{display:none;}

你的 jQuery 可以是:

$(".collapse").on('click', function(){
$('.collapse').addClass('hidden');
$(this).removeClass('hidden');
});

关于PHP Codeigniter foreach 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41662785/

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