str_replace(find,replace,string,count)
find:需要替換的值
replace:將要替換的值,
string:被替換的字符串
count:同級替換的次數
如果需要把數據庫中存儲的帶回車以及空格的文章,按照其原來的樣式顯示在html中,可以使用此函數,
function htmtocode( $content ) {
$content = str_replace( '\n','<br/>',str_replace(' ',' ' ,$content) );
return $content;
}
