Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.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 将ereg_替换更改为preg_替换_Php_Regex_Preg Replace_Ereg Replace - Fatal编程技术网

Php 将ereg_替换更改为preg_替换

Php 将ereg_替换更改为preg_替换,php,regex,preg-replace,ereg-replace,Php,Regex,Preg Replace,Ereg Replace,看起来很简单,但我有问题 ereg_replace("\n","\\n",$row) ereg_替换(“\n”、“\\n”、$row) 进入preg_替换 任何人都可以帮我一把吗?您唯一需要更改的事情(函数名除外)是在模式中添加分隔符(本例中为斜杠): 但是,在这种特殊情况下,您不需要使用regex(速度足够慢),simple就可以了: str_replace("\n", "\\n", $row); 唯一需要更改的是(函数名除外)向模式中添加分隔符(本例中为斜杠): 但是,在这种特殊情况下,您

看起来很简单,但我有问题

ereg_replace("\n","\\n",$row) ereg_替换(“\n”、“\\n”、$row) 进入preg_替换


任何人都可以帮我一把吗?

您唯一需要更改的事情(函数名除外)是在模式中添加分隔符(本例中为斜杠):

但是,在这种特殊情况下,您不需要使用regex(速度足够慢),simple就可以了:

str_replace("\n", "\\n", $row);

唯一需要更改的是(函数名除外)向模式中添加分隔符(本例中为斜杠):

但是,在这种特殊情况下,您不需要使用regex(速度足够慢),simple就可以了:

str_replace("\n", "\\n", $row);

手册中也有说明:手册中也有说明: