[PHP] 顯示 html 原始碼

function likepre ($string) {
$string = str_replace('"','"',$string);
$string = str_replace("'",''',$string);
$string = str_replace("<","&lt;",$string);
$string = str_replace(">","&gt;",$string);
$string = str_replace("\t"," ",$string);                //換為全角空格
$string = str_replace("  "," ",$string);                //兩個半角空格換為全角空格
$string = nl2br($string);
return $string;
}

From:笨笨林@PHPChina

Please follow and like us:

One comment on “[PHP] 顯示 html 原始碼

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *