strtr对用户输入的敏感词汇进行过滤

/**
 * 过滤用户输入的基本数据,防止script攻击
 *
 * @access      public
 * @return      string
 */
function compile_str($str)
{
    $arr = array('<' => '<', '>' => '>','"'=>'”',"'"=>'’');

    return strtr($str, $arr);
}

 

posted on 2016-11-26 15:18  爱吃柠檬不加糖  阅读(317)  评论(0编辑  收藏  举报

导航