
如何修复XAMPP本地环境HTTP 404错误 “未找到请求的资源”
deslash ( $content )
deslash是一个WordPress的函数,可以从一个字符串或一个字符串数组中删除斜线: 这个函数在处理从表单中提交的数据时非常有用,在这些数据中可能已经添加了斜线以防止某些字符破坏表单。
内容的过滤器,删除不必要的斜线。
function deslash( $content ) { // Note: \ inside a regex denotes a single backslash. /* * Replace one or more backslashes followed by a single quote with * a single quote. */ $content = preg_replace( "/\+'/", "'", $content ); /* * Replace one or more backslashes followed by a double quote with * a double quote. */ $content = preg_replace( '/\+"/', '"', $content ); // Replace one or more backslashes with one backslash. $content = preg_replace( '/\+/', '\', $content ); return $content; }