gpt4 book ai didi

php for循环破坏网站布局

转载 作者:太空宇宙 更新时间:2023-11-04 04:22:26 25 4
gpt4 key购买 nike

这是我的旧代码

$xml .=  '<select style="width:80%;margin-bottom:10px;" name="qty" class="input-text qty" id="qty">';
foreach ($prices as $price) {
$xml .= '<option value="'.$price['price_qty'].'">'.$price['price_qty'].' pieces - '.$price['formated_price'].' each</option>';
}
$xml .= '</select>';

我用这段代码替换了它

$xml .=  '<select style="width:80%;margin-bottom:10px;" name="qty" class="input-text qty" id="qty">';
for ($i=1;$i<=100;$i++) {
$xml .= '<option value="'.$i.'">'.$i.'</option>';
}
$xml .= '</select>';

由于某种原因循环破坏了我的网格布局。有人可以告诉我我的代码有什么问题吗?

最佳答案

这是正确的代码:$i 与脚本的其他部分重叠

$xml .=  '<select style="width:80%;margin-bottom:10px;" name="qty" class="input-text qty" id="qty">';
for ($c=1;$c<=100;$c++) {
$xml .= '<option value="'.$c.'">'.$c.'</option>';
}
$xml .= '</select>';

关于php for循环破坏网站布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18837367/

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