我无法将冒号定义的数组转换为在表格中显示(如下所述)。任何人都可以指导我。
resources :users, only: [:show, :index] do
resources :characters do
collection do
get 'on_clan_change'
end
end
end
必须看起来像这种表格格式:
答案 0 :(得分:0)
<?php
$info='Title:Beckham,Age:43,Address:UK';
$info_array = explode(",",$info);
$table = "<table>";
foreach($info_array as $row){
$row_obj_array = explode(":",$row);
$table .= "<tr><td>$row_obj_array[0]</td><td>$row_obj_array[1]</td></tr>";
}
$table.="</table>";
echo $table;
?>