我有以下数组
Array ( [0] => Please enter address line 1
[1] => Please tell us your first name
[2] => Please tell us your last name
[3] => Please tell us your email
[4] => You must tell us one phone number
[5] => Please tell us second applicants title
[6] => Please tell us second applicants first name
[7] => Please tell us second applicants last name )
我循环遍历如下
foreach($error_hash as $value)
{
echo "error <li> $value <li/>";
}
令人讨厌的是我一直在拿空行
任何输入都会很棒
答案 0 :(得分:5)
在'li'标签内嵌入'错误',因此不会产生额外的输出。类似的东西:
echo "<li> error, $value </li>";
答案 1 :(得分:1)
观看您的标记
<li/>
也许这会有所帮助:
</li>
:)
答案 2 :(得分:1)
我已经查过了。这是工作。
$a[0] = 'Please enter address line 1';
$a[1] = 'Please tell us your first name';
foreach ($a as $b) {
echo $b;
}