当前位置: 首页 > 后端技术 > PHP

php提示Calltoundefinedfunctionfnmatch()解决

时间:2023-03-29 17:19:21 PHP

今天启动的项目出现如下错误信息:Calltoundefinedfunctionfnmatch()Thisisaproblemoffnmatchcannotbeusedonnon-POSIXsystemsother比窗户。解决思路是:先判断fnmatch方法是否存在,存在则使用fnmatch方法,不存在则使用其他方法替换fnmatch方法,如:if(!function_exists('fnmatch')){如果(preg_match("#^".strtr(preg\_quote($pattern,'#'),array('\*'=>'.*','\?'=>'.'))."$#i",$id)){$exceptMatch=true;休息;}}elseif(fnmatch($pattern,$id)){$exceptMatch=true;休息;}根据上面,Calltoundefinedfunctionfnmatch()报错问题就可以解决