gpt4 book ai didi

javascript - PHP :Displaying html formatted data from sqlite database, 使用tinymce保存

转载 作者:行者123 更新时间:2023-11-28 00:25:35 25 4
gpt4 key购买 nike

我正在使用sqlite数据库在php中开发应用程序。我已经为文本区域集成了tinymce 4.1.9。当我将数据保存在数据库中时,会保存正确的 html 脚本,但是在报告上显示数据库中的数据时,所有 html 标签都不会反射(reflect)。例如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'];}
?>

请建议如何在报表上显示格式化数据?

最佳答案

尝试使用 PHP htmlentities() 函数将字符转换为 html 格式。让我知道结果。

关于javascript - PHP :Displaying html formatted data from sqlite database, 使用tinymce保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29530390/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com