PHP生成HTML后的奇怪空格
问题描述:
我有一个奇怪的问题。我有一个动态网站www.lamanscanada.com它看起来很好,在Firefox和Safari浏览器,几乎完美的IE7。但似乎在某些PHP生成的HTML。在函数输出后添加了一堆空间。我也使用mod_rewrite为好SEO网址只是一个说明。PHP生成HTML后的奇怪空格
的函数对数据的阵列成列子弹
<?php
//breaks array values into two columns
function groupBullets($array){
//count the array items
$bulletcount = count($array);
//divides that in two and round the result
$roundhalf = round(($bulletcount/2));
//initailize a counting variable
$i=1;
//loop throught the array
foreach($array as $bullet){
//if it is the first item
if($i==1){
echo "<span class=\"container\">";//open the main container div
}
echo "<span class=\"bullet\">• $bullet</span>";//then create bullet
//if the counter is at the half mark
if($i==$roundhalf){
echo "</span>";//close the container
$i=1;//and start the counter over
}else{
$i++;//if not at half keep counting
}
}
}
//end
//I am implementing it like this:
//this is my array it actually has a second level
$array = array(
columngroup01("bullet 1","bullet 2","bullet 3","bullet 4"),
columngroup02("bullet 1","bullet 2","bullet 3","bullet 4")
);
//I loop through this array
foreach($array as $column=>$arrayofbullets){
echo "<div class=\"columncontainer\">".//open the div contains the columns
"<div class=\"heading\">$column</div>";//print the title of the column
//use the groupBullets function on each array of bullets
groupBullets($arrayofbullets);
echo "</div>";//close the column container
}
?>
答
的<span class="features">
在<span class="featureitem">
标签所生成的列表的结束没有被关闭。
电流产生的输出:
<div class="infoblock">
<div class="infoheading">features</div>
<span class="features">
<span class="featureitem">• 10'X6'X8' Aluminum Extrusion Structure</span>
<span class="featureitem">• R18 Insulated Panels</span>
...
</div>
需要是:
<div class="infoblock">
<div class="infoheading">features</div>
<span class="features">
<span class="featureitem">• 10'X6'X8' Aluminum Extrusion Structure</span>
<span class="featureitem">• R18 Insulated Panels</span>
...
</span>
</div>
+0
哇这些事情之一....有时你需要的是一个新的眼睛,非常感激。 – Laurence 2011-04-15 01:39:19
你明白这个问题的固定或者你还想就这个问题的帮助? – 2011-04-12 11:08:49