HTML生成器:将HTML转换为PlainText并使用PHP放入文本框 [英] HTML Generator: Convert HTML to PlainText and put in a TextBox using PHP
问题描述
我想制作一个生成器,以便在eBay描述中轻松完成工作。
所以我创建了一个页面,其中有一些表单输入将值发送到主页iframe中的一个php页面。
现在我需要将完整的HTML代码放在iframe中(自然我可以看到完整的呈现页面),我需要查看源代码,复制并放入eBay的html描述中。
所以,问题是:我可以将HTML代码转换为纯文本并放入文本框,以便使用按钮轻松复制吗?我不需要wysiwycg。
我已经使用了Google搜索功能,但找不到合理的结果。
根据您的回复,是现在的代码:
Page1.php
//它是只有包含必须传递变量的表单的页面
Page2.php
$ html = file_get_contents('desc.php');
echo'< textarea readonly style =border:none; resize:nonerows =50cols =116value ='。$ html。'>< textarea的>';
Page3.php
//这是必须使用纯文本的文件desc.php
现在我得到了纯文本文件,但是因为我将它们存储在会话中,因此不会传递变量。
文本框只显示文件的一半,不显示< link>
和< style>
标记。
您可以使用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内框>
<$ php echo $ content; ?>
< / div>
< / iframe>
I would like to make a generator to get easy work in eBay description. So i've created a page with some form input that send the value to a php page in the main page iframe. Now I need to take the full HTML code and put in the iframe (naturally I get the full rendered page) and I need to view the source code, copy and put in the eBay html description.
So, the question is: Can I convert the HTML code as plain text and put in a textbox so I can easily copy using a button? I don't need a wysiwycg.
I've googled it but can't find a reasonable result.
According to your reply, here is the code now:
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
Now I get the plain text file but the variables aren't passed since i've stored them in session.
And the textbox displays only half of the file, not showing the <link>
and <style>
tags.
You can use file_get_contents
$homepage = file_get_contents('http://www.example.com/');
echo $homepage;
or
echo "<td><input type='text' value='$homepage'/></td>";
or for i frame
<iframe>
<div inside frame>
<$php echo $content; ?>
</div>
</iframe>
这篇关于HTML生成器:将HTML转换为PlainText并使用PHP放入文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!