how to close open html tags automatically with php?
I developed many sites on php and mysql.
I have a problem on fetching certain words like i useSELECT *,left('<field>',200) from < table >
I got the problem on layout of whole website due to no closing of opened tags.
any suggestion would be great.I used strip_tags()
and then substr()
to crop text.
update
<?php
$fragment = '<p>What a mighty开发者_StackOverflow中文版 fine <a href="blah">da';
$tidy = new tidy();
$tidy->parseString($fragment,array('show-body-only'=>true),'utf8');
$tidy->cleanRepair();
echo $tidy;
?>
enable php_tidy extension
in localhost through php.ini and it works.
<?php
$fragment = '<p>What a mighty fine <a href="blah">da';
$tidy = new tidy();
$tidy->parseString($fragment,array('show-body-only'=>true),'utf8');
$tidy->cleanRepair();
echo $tidy;
?>
enable php_tidy extension
in localhost through php.ini and it works.
精彩评论