开发者

how to close open html tags automatically with php?

开发者 https://www.devze.com 2023-01-27 12:03 出处:网络
I developed many sites on php and mysql. I have a problem on fetching certain words like i use SELECT *,left(\'<field>\',200) from < table >

I developed many sites on php and mysql.

I have a problem on fetching certain words like i use

SELECT *,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.

but i need a permanent solution.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消