HTML tags not being rendered

后端 未结 3 1869
眼角桃花
眼角桃花 2021-01-14 10:06

I\'m building a simple blog system with FuelPHP and TinyMCE editor.

When I format my text in the TinyMCE (or CKEditor, doesn\'t matter) and save it in my database ev

相关标签:
3条回答
  • 2021-01-14 10:47

    How can you pass the data to the view? Can you show the code?

    If you are using the View class there is a method which can let you choice when to encode the text or not (default is yes).

    0 讨论(0)
  • 2021-01-14 10:48

    when you save your data in database its encoded for some security reasons you just need to

    html_entity_decode("string retrived from database");

    and then print it.

    0 讨论(0)
  • 2021-01-14 10:50

    Instead of encoding and decoding you can use the set_safe() method or use the $filter argument in set().

    Like this:

    $view->set_safe('body', $data);
    

    Or

    $view->set('body', $data, false);
    

    Or whitelist your view. Which will prevent decoding.

    0 讨论(0)
提交回复
热议问题