HTML生成器:将HTML转换为纯文本并使用PHP放入文本框中


HTML Generator: Convert HTML to PlainText and put in a TextBox using PHP

我想做一个生成器,以便在eBay描述中轻松工作。因此,我创建了一个带有一些表单输入的页面,该页面将值发送到主页 iframe 中的 php 页面。现在我需要获取完整的HTML代码并放入iframe(自然我得到完整的渲染页面),我需要查看源代码,复制并放入eBay html描述。

所以,问题是:我可以将HTML代码转换为纯文本并放入文本框中,以便我可以使用按钮轻松复制吗?我不需要所见即所得。

我已经用谷歌搜索过,但找不到合理的结果。

根据您的回复,现在是代码:

页1.php

// It's only the page containing the form that must to pass variables

页2.php

$html = file_get_contents('desc.php');
echo '<textarea readonly style="border:none;resize:none" rows="50" cols="116" value="'. $html .'"></textarea>';

页3.php

// This is the file desc.php that must to be in plaintext

现在我得到了纯文本文件,但变量没有传递,因为我将它们存储在会话中。

文本框仅显示文件的一半,不显示<link><style>标签。

您可以使用file_get_contents

$homepage = file_get_contents('http://www.example.com/');

echo $homepage;

 echo "<td><input type='text' value='$homepage'/></td>";

或对于 i 帧

<iframe> 
   <div inside frame>
      <$php echo $content; ?>
   </div>
</iframe>