abstract:$str = '<h3>他是\'一個(gè)有"故事"的人</h3>'; echo '未經(jīng)過解析輸出:',htmlspecialchars($str),'<br>'; echo '未經(jīng)過解析轉(zhuǎn)義輸出:',htmlentities($str)
$str = '<h3>他是\'一個(gè)有"故事"的人</h3>'; echo '未經(jīng)過解析輸出:',htmlspecialchars($str),'<br>'; echo '未經(jīng)過解析轉(zhuǎn)義輸出:',htmlentities($str),'<br>';
htmlspecialchars()和htmlentities()都可以輸出未經(jīng)過解析的HTML源碼,htmlspecialchars():將代碼中的引號(hào),&,標(biāo)簽標(biāo)記<,>轉(zhuǎn)為html實(shí)體字符,不解析
htmlentities():將所有的的html標(biāo)記全轉(zhuǎn)實(shí)體,包括htmlspecialchars()中的標(biāo)記
Correcting teacher:天蓬老師Correction time:2019-03-21 13:06:32
Teacher's summary:你這是原樣輸出呀, 把教學(xué)代碼直接復(fù)制過來了