一開始這樣寫,但出問題

function trim_dom_node($string){
$string=str_replace(" <","<",$string,$count);
echo "com  ";
if($count >= 1)
{
    trim_dom_node($string);
}
else {return str_replace("\n<","<",$string);}
}

改成這樣,呼叫function 加上 return

function trim_dom_node($string){
$string=str_replace(" <","<",$string,$count);
echo "com  ";
if($count >= 1)
{
    return trim_dom_node($string);
}
else {return str_replace("\n<","<",$string);}
}

Felix 發表在 痞客邦 PIXNET 留言(0) 人氣()