大规模杀伤性武器 - 如何获取生成\降价HTML代码
-
26-09-2019 - |
题
以及我得到了大规模杀伤性武器,但我无法了解如何获取生成的HTML \降价代码....我想将它发送到DB ...为什么我使用PHP,多数民众赞成....
<script src='wmd.js'></script>
<form name="formname" method='POST'>
<textarea id="myTextarea" style="width: 500px; height: 200px;">
*This* example sets WMD's options programmatically.
</textarea>
<input type="submit" name="sub" value="submit">
</form>
<!--Preview Can Be Seen Here-->
<div class="wmd-preview" id="wmd"></div>
<?php
if( isset( $_POST['sub'] ) )
{
$generated_HTML = "How to get it here";
}
?>
现在,任何人都可以请告诉我怎么去生成的HTML ...
解决方案
在WMD编辑仅有一个客户端的文本编辑器,它支持降价格式的文本的输入。转换到降价HTML你需要一个降价解析器。
一个快速谷歌告诉我,至少还有一个版本: http://michelf.com/projects / PHP-减价/
其他提示
获取这些文件wmd.js
& markdown.php
和使用follwing代码
<script src="wmd.js"></script>
<script type="text/javascript">
wmd_options = {output: "HTML",lineLength: 40,buttons: "bold italic | link image | ol ul heading hr",autostart: true};
</script>
<form name="formname" method="post" action="">
<textarea id="myTextarea" style="width: 500px; height: 200px;" name="TA"></textarea>
<br><input type="submit" name="KILL" value="Submit">
</form>
<?php
if( isset( $_POST['kil'] ) )
{
$my_text = $_POST['tr'];
include ('markdown.php');
$my_html = Markdown($my_text);
echo $my_html;
//$send $myhtml to database or do something with
}
?>
不隶属于 StackOverflow