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]] )
posted on 2006-04-01 13:09  liuchen 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/liuchen/archive/2006/04/01/364184.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值