【发布时间】:2015-06-14 08:09:57
【问题描述】:
我正在使用 sqlite 数据库在 php 中开发应用程序。我已经为 textarea 集成了 tinymce 4.1.9。当我在数据库中保存数据时,正确的 html 脚本会被保存,但是在报告中显示数据库中的数据时,所有 html 标记都不会反映。例如 H1 或列表或粗体不显示其效果。甚至标签也保存在数据库中。 脚本如下:
<script language="javascript" type="text/javascript" src="tinymce/js/tinymce/tinymce.min.js"></script>
<script language="javascript" type="text/javascript">
tinymce.init({
selector: "textarea",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
]
});
</script>
HTML:
<textarea name="txtAboutComp" class="form-control" rows="5" ></textarea>
在报告中显示数据:
<?php
try
{
$sqlite = new PDO('sqlite:DigitalStorageBox.sqlite');
}
catch (PDOException $e)
{
echo 'Connection failed: ' . $e->getMessage();
}
$statement = $sqlite->prepare('SELECT distinct ID, Name, LogoPath,CompanyName,AboutCompany from Company ');
try
{
$statement->execute();
}
catch (PDOException $e)
{
echo "Statement failed: " . $e->getMessage();
return false;
}
$result = $statement->fetchAll();
$cnt=0;
foreach ($result as $row)
{ echo $row['AboutCompany'];}
?>
请建议如何在报告中显示格式化数据?
【问题讨论】:
-
检查是否应用了css样式并且不与主css中的其他样式重叠
-
只是一个愚蠢的问题,您是在
区域内还是在页面上回显 $row['AboutCompany']? -
使用 F12 调试器并复制您所看到的内容
-
问题已解决。样式表重叠。感谢您的帮助
标签: javascript php html sqlite tinymce