zoukankan      html  css  js  c++  java
  • php与html页面交互的几个函数

    1,字符串的转义操作vs取消转义
        form表里面提交的字符串将一些字符,比如',",\等自动添加\转义成为\',\",\\,可以使用函数
    string stripslashes ( string str )
        与此相反,添加转义\字符,可以使用string addslashes ( string str )

    2,显示html和js代码vs执行代码
        有些用户添加一些js代码,然而我们不希望他们执行,仅仅让他们显示,可以使用函数
    string htmlentities ( string string [, int quote_style [, string charset]] )
    string htmlspecialchars ( string string [, int quote_style [, string charset]] )
        作用如下:

            '&' (ampersand) becomes '&' 
            '"' (double quote) becomes '"' when ENT_NOQUOTES is not set. 
            ''' (single quote) becomes ''' only when ENT_QUOTES is set. 
            '<' (less than) becomes '&lt;' 
            '>' (greater than) becomes '&gt;' 

        如果要执行,可以执行相反的函数,如下
    string html_entity_decode ( string string [, int quote_style [, string charset]] )
  • 相关阅读:
    tcp/ip--百度百科
    Web service--百度百科
    .NET--百度百科
    ibatis--百度百科
    Struts2--百度百科
    spring--百度百科
    从头认识Spring-1.15 对SpEl的值的操作(1)-数值运算
    performSelector 方法的自己主动俘获特性
    图解WinHex使用入门
    LINQ使用与并行
  • 原文地址:https://www.cnblogs.com/liuchen/p/364184.html
Copyright © 2011-2022 走看看