Home  >  Article  >  Backend Development  >  怎么将从数据库取得的数据循环写入5个dl

怎么将从数据库取得的数据循环写入5个dl

WBOY
WBOYOriginal
2016-06-13 10:14:301126browse

如何将从数据库取得的数据循环写入5个dl
第一遍循环完成后再回到第一个dl往里面追加数据。

------解决方案--------------------
// 如数据库取得的数据
$arr = array(
0 => array(
'name' => '张三',
'job' => 'php程序员',
),
1 => array(
'name' => '李四',
'job' => '网页设计师',
),
2 => array(
'name' => '王五',
'job' => 'web开发工程师',
),
);

$dlstr = '';
foreach ($arr as $k => $v)
{
$dlstr .= "

{$v['name']},{$v['job']}
";
}

echo $dlstr;
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn