在thinkphp中使用ueditor 编辑器解决自动加入转义符的问题

阅读更多

在thinkphp中使用ueditor 编辑器,在编辑器中加入超链接或者插入图片,数据提交后会在双引号前面自动加上转义符。解决的方法如下:
修改thinkphp框架的common.php文件(具体路径为ThinkPHP\Common\common.php),在最后加上如下代码即可。

//取消thinkphp里面的转义
if (get_magic_quotes_gpc()) {
	function stripslashes_deep($value)
	{
		$value = is_array($value) ?
		array_map('stripslashes_deep', $value) :
		stripslashes($value);
		return $value;
	}
	
	$_POST = array_map('stripslashes_deep', $_POST);
	$_GET = array_map('stripslashes_deep', $_GET);
	$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}

 

你可能感兴趣的:(thinkphp,ueditor)