HTML生成器:将HTML转换为PlainText并使用PHP

时间:2016-01-22 12:34:10

标签: php html iframe

我想制作一台发电机,以便在eBay描述中轻松工作。 所以我创建了一个页面,其中包含一些表单输入,将值发送到主页面iframe中的php页面。 现在我需要获取完整的HTML代码并放入iframe(当然我得到完整的渲染页面),我需要查看源代码,复制并放入eBay html描述。

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

我用谷歌搜索了它,但无法找到合理的结果。

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

page1.php中

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

使page2.php

$html = file_get_contents('desc.php');

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

Page3.php

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

现在我收到纯文本文件,但由于我已将这些变量存储在会话中,因此没有传递变量。

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

1 个答案:

答案 0 :(得分:3)

您可以使用file_get_contents

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


echo $homepage;

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

或i frame

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