0
我有一個奇怪的問題。我有一個動態網站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
}
?>
你明白這個問題的固定或者你還想就這個問題的幫助? – 2011-04-12 11:08:49