function getotherResource(){
$result = json_decode($this->curl->simple_get($this->API.'/otherResource'));
$html = "";
foreach($result as $r){
$html.="<div class='m-b-xs m-t'>
<label class='i-checks i-checks-md'>
<input type='checkbox' name='chkotherResource' id='v-".$r->qEmployee."' value='".$r->employeeName."'>
<i></i>
".$r->employeeName."
</label>
</div>";
}
echo $html;
}
这是我的显示器如何使用数组更改这样的外观?
我会使用 css 来解决这个问题,特别是新的网格规范。我会将foreach包装在另一个div.wrapper中:
function getotherResource(){
$result = json_decode($this->curl->simple_get($this->API.'/otherResource'));
$html = "***<div class='wrapper'>***";
foreach($result as $r){
$html.="<div class='m-b-xs m-t'>
<label class='i-checks i-checks-md'>
<input type='checkbox' name='chkotherResource' id='v-".$r->qEmployee."' value='".$r->employeeName."'>
<i></i>
".$r->employeeName."
</label>
</div>";
}
***$html.="</div>"***
echo $html;
}
并添加以下 css。
.wrapper {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(2, 50%);
}