php twig tinymce标记html不会转义
您好,我在twig视图中使用tinymce作为我的表单,但是html标记显示在我的最终视图以及我的数据库中。例如,当我使用tinymce创建帖子和内容时,我使用了强标记细枝显示:在我的控制器中:php twig tinymce标记html不会转义,php,html,tinymce,Php,Html,Tinymce,您好,我在twig视图中使用tinymce作为我的表单,但是html标记显示在我的最终视图以及我的数据库中。例如,当我使用tinymce创建帖子和内容时,我使用了强标记细枝显示:在我的控制器中: $postmanager = new PostManager(); $postaddview = $postmanager->
$postmanager = new PostManager();
$postaddview = $postmanager->createPost($utilisateurId, $title, $chapo, $content);
在我的模型中:
$bd = $this->connection();
$bdpostadd = $bd->prepare('INSERT INTO posts (id_utilisateur, title, chapo, content) VALUES(?, ?, ?, ?)');
$postadd = $bdpostadd->execute(array($utilisateurId, $title, $chapo, $content));
return $postadd;
当我在视图中显示时:在我的模型中:
`
post class是一个实体:
private $content;
public function __construct($donnees)
{
if (is_array($donnees)) {
$this->hydrate($donnees);
}
}
public function hydrate(array $donnees)
{
foreach ($donnees as $key => $value) {
$method = 'set'.ucfirst($key);
if (method_exists($this, $method)) {
$this->$method($value);
}
}
}
public function content()
{
return $this->content;
}
public function setContent($content)
{
if (is_string($content)) {
$this->content = $content;
}
}
在我的控制器中:`
$postsadminview = $this->post()->showPostsUser($_GET['id']);
$twigview = $this->getTwig();
$twigpostsmanager = $twigview->load('Backend/managerposts.twig');
echo $twigpostsmanager->render(array('postsadminview' => $postsadminview));
`
我不在任何地方使用HTMLSpecialChar或实体
我在初始化tinymce时尝试了这个:
forced_root_block : false,
force_br_newlines : true,
force_p_newlines : false,
entity_encoding : "raw",
allow_html_in_named_anchor: true,
encoding: "UTF-8"
但是标记html在我的视图中也是这样的ddddd
如果有人知道解决方案,我将不胜感激谢谢你在你的小树枝模板中使用了过滤器
raw
,对吗?是的,我在我的小树枝上使用了过滤器raw view it work谢谢@DarkBee
forced_root_block : false,
force_br_newlines : true,
force_p_newlines : false,
entity_encoding : "raw",
allow_html_in_named_anchor: true,
encoding: "UTF-8"