开发者

save a txt document with php without html content [closed]

开发者 https://www.devze.com 2023-03-09 01:06 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 8 years ago.

Improve this question

the file now is like this:

<p>User friendly buttons and IR Remote Contr开发者_运维技巧ol for easy control&nbsp;</p>
<p>Quality stereo headset enables user to enjoy hi-fi dynamic sound&nbsp;</p>
<p>Replaceable, rechargeable Li-polymer battery&nbsp;</p>
<p>Specs Video transmission frequency: 2414, 2432, 2450, 2468&nbsp;</p>
<p>Transmission distance: Approx 100m in open space&nbsp;</p>
<p>Bitmap Audio carrier wave: 6.0Mhz, 6.5mHz, + 50Khz&nbsp;</p>
<p>&nbsp;</p>
<p>S/N Ratio: 50-70 db&nbsp;</p>
<p>Diplay: True Color Micro LCD&nbsp;</p>
<p>Resolution: Full color 922k pixels, 640*480&nbsp;</p>
<p>Viewing Angle: Diagonal 32 degree&nbsp;</p>
<p>Virtual Image Size: 80inches at 2M away&nbsp;</p>
<p>Contrast: 64:1, Color Depth: 24 bit &nbsp;</p>

I would like to get the same file but just the text (be carrefull there are things like &lt that i want them to be "<"


<?php
$str = html_entity_decode(strip_tags($str));
?>


$html = '<p>Your &lt; html &gt;  &nbsp; here</p>';
$text = strip_tags($html);
$text = html_entity_decode($text);
echo $text;

Output: Your < html > here

Strip tags doc: http://us.php.net/manual/en/function.strip-tags.php

Html Entity Decode doc: http://php.net/manual/en/function.html-entity-decode.php


The PHP function strip_tags will remove all the <p> for you and html_entity_decode will fix up your &lt; and co.

0

精彩评论

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