---
title: "在thinkphp中使用ueditor 编辑器解决自动加入转义符的问题"
author: "junpub"
date: "2015-09-24T16:36:45Z"
tags: []
categories: ["编程语言"]
slug: "thinkphp-ueditor"
draft: false
lastmod: "2015-09-24T16:36:45Z"
id: 2245866
url: "https://junxgd.iteye.com/blog/2245866"
---

在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);
}
```