I have few comma separated values .I have added it to an array name 'meter_status' .I exploded it I want to add these data to html table row ,in the way in one cell i have to split it and display it
I tried with the following code. But it is not display in td format what can be the issue
$each=explode(',',$meter_status);
$count= count($each);
$status.='<td rowspan="'.$count.'">';
foreach( $each as $link){
$status.= $link;
}
$status.='</td>';
return $status;
Try this :
<?php
$each=explode(',',$meter_status);
$count= count($each); ?>
$status.='<td rowspan="'.$count. '"'
foreach( $each as $link){
$status .= <<<TEXT
<tr>
<td>$link</td>
</tr>
TEXT;
}
return $status;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.