zoukankan      html  css  js  c++  java
  • php形式的内容被处理

    /**
    	 * 过滤HTML内容RETURN
    	 *
    	 * @param      $string
    	 * @param bool $html
    	 *
    	 * @return array|string
    	 */
    	public static function safeOutput($string, $html = false) {
    		if (!$html)
    			$string = strip_tags($string);
    
    		return @Tools::htmlentitiesUTF8($string, ENT_QUOTES);
    	}
    
    	public static function htmlentitiesUTF8($string, $type = ENT_QUOTES) {
    		if (is_array($string))
    			return array_map(array('Tools', 'htmlentitiesUTF8'), $string);
    
    		return htmlentities((string)$string, $type, 'utf-8');
    	}
    
    	public static function htmlentitiesDecodeUTF8($string) {
    		if (is_array($string))
    			return array_map(array('Tools', 'htmlentitiesDecodeUTF8'), $string);
    
    		return html_entity_decode((string)$string, ENT_QUOTES, 'utf-8');
    	}
    
    	/**
    	 * 对POST内容进行处理
    	 *
    	 * @return array
    	 */
    	public static function safePostVars() {
    		if (!is_array($_POST))
    			return array();
    		$_POST = array_map(array('Tools', 'htmlentitiesUTF8'), $_POST);
    	}
    

    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    单例模式创建
    盛最多水的容器
    魔术索引
    钢条切割
    比较版本号
    矩阵中的路径
    机器人的运动范围
    计网基础问题
    Linux 下android环境的配置
    Fedora15下安装Android开发环境
  • 原文地址:https://www.cnblogs.com/mfrbuaa/p/4655368.html
Copyright © 2011-2022 走看看