但是我要传入的数据用的是HTML在线编辑器的内容
Home > Backend Development > PHP Tutorial > THINKPHP uses filtering problem in I() function

THINKPHP uses filtering problem in I() function

WBOY
Release: 2016-08-08 09:06:39
Original
1982 people have browsed it

I am using TP. You can set the filtering method of function I() in the settings
THINKPHP uses filtering problem in I() function
But the data I want to pass in is the content of the HTML online editor
THINKPHP uses filtering problem in I() function
It can contain legal tags. For example

  • ...
    In order to prevent XSS attacks, it is no problem for the I function to set the default filter to htmlspecialchars, but how to keep the tags you want? There is a tutorial that uses this It is a plug-in HTMLPurifer, but the efficiency is too low and it is not recommended to use it too much.
    Question: When the default filter of the I function in TP is htmlspecialchars, how can I retain the tags I want?

    Reply content:

    I am using TP. You can set the filtering method of function I() in the settings
    THINKPHP uses filtering problem in I() function
    But the data I want to pass in is the content of the HTML online editor
    THINKPHP uses filtering problem in I() function
    It can contain legal tags. For example

  • ...
    In order to prevent XSS attacks, it is no problem for the I function to set the default filter to htmlspecialchars, but how to keep the tags you want? There is a tutorial that uses this It is a plug-in HTMLPurifer, but the efficiency is too low and it is not recommended to use it too much.
    Question: When the default filter of the I function in TP is htmlspecialchars, how can I retain the tags I want?

    <code>function I($name,$default='',$filter=null,$datas=null) {</code>
    Copy after login

    So you can specify not to use filters when receiving edits, such as i('content','',null);

    Related labels:
    php
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template