Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.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 如何将eregi替换为preg_match?_Php_Preg Match_Eregi - Fatal编程技术网

Php 如何将eregi替换为preg_match?

Php 如何将eregi替换为preg_match?,php,preg-match,eregi,Php,Preg Match,Eregi,可能重复: 我想用preg_match更改这一行,但它不起作用 if ($file != "." && $file != ".." && !eregi(".jpg".$thumbext."$",$file) && eregi(".jpg$",$file)){ 我试过: if ($file != "." && $file != ".." && !preg_match(".jpg".$thumbext."$",$fi

可能重复:

我想用preg_match更改这一行,但它不起作用

if ($file != "." && $file != ".." && !eregi(".jpg".$thumbext."$",$file) && eregi(".jpg$",$file)){
我试过:

if ($file != "." && $file != ".." && !preg_match(".jpg".$thumbext."$",$file) && preg_match(".jpg$",$file)){
应该怎样


谢谢

preg需要分隔符:

preg_match('/.jpg'.$thumbex.'$/',$ile)

您可能需要向我们展示
$thumbtext
中的内容,谢谢,它工作得非常好!