我需要使用一些 div 类将我的 PHP 数组转换为 html。
这是我的代码:
<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
{ die('Could not connect: ' . mysql_error());
}
mysql_select_db("asd", $con);
$result = mysql_query("SELECT * FROM asd");
$something = array();
while ($row = mysql_fetch_assoc($result)) {
$something[] = array("title"=>$row['title'],
"name"=>$row['name'],
"content"=>$row['content'],
"image" =>
array(
"cls"=>"slide-image",
"_src"=>$row['src'],
"source"=>$row['source']
)
);
}
mysql_close($con);
?>
我想要这样的输出
<div class="class1"> Here title goes</div>
Here name with some class
Here content with some class
请问有什么帮助吗?