Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用哪个转义将正则表达式插入数据库并使其原封不动地返回?_Php_Mysql_Regex - Fatal编程技术网

Php 使用哪个转义将正则表达式插入数据库并使其原封不动地返回?

Php 使用哪个转义将正则表达式插入数据库并使其原封不动地返回?,php,mysql,regex,Php,Mysql,Regex,将正则表达式插入数据库并读取它的最佳方法是什么,我尝试了一些php函数,如 不平等 htmlspecialchars 连载 但是在我从MySQL获取正则表达式之后,我不能使用它,它不起作用。 我尝试用一个文本文件保存正则表达式,结果是一样的。如果你想在mysql中插入一些特殊字符,那么htmlentities对FALG很有用 htmlspecialchar仅将一些特殊字符转换为HTML实体,如 '&' (ampersand) becomes '&' '"' (d

将正则表达式插入数据库并读取它的最佳方法是什么,我尝试了一些php函数,如

不平等 htmlspecialchars 连载 但是在我从MySQL获取正则表达式之后,我不能使用它,它不起作用。
我尝试用一个文本文件保存正则表达式,结果是一样的。

如果你想在mysql中插入一些特殊字符,那么htmlentities对FALG很有用

htmlspecialchar仅将一些特殊字符转换为HTML实体,如

'&' (ampersand) becomes '&'
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
''' (single quote) becomes ''' only when ENT_QUOTES is set.
'<' (less than) becomes '&lt;'
'>' (greater than) becomes '&gt;'
也读


乐意帮忙:

你误读了这个问题。他问如何在数据库中存储一些包含特殊字符的文本,这里是regexp。@konerak你读了第一行了吗?在数据库中插入正则表达式的最佳方法是什么?是的。他想在数据库中插入一些文本。文本恰好是一个正则表达式。您刚才给了一些现有的MySQL命令,将其放入where子句中,该子句与从数据库中选择内容有关,而不是INSERT。@user71。。。你的欢迎:请更改用户名..一些好名字
'&' (ampersand) becomes '&amp;'
'"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set.
''' (single quote) becomes '&#039;' only when ENT_QUOTES is set.
'<' (less than) becomes '&lt;'
'>' (greater than) becomes '&gt;'