在Windows上编码,不在Linux上运行

时间:2017-03-20 17:38:48

标签: php linux windows curl

我在Linux上遇到了我的代码问题,它在运行PHP 7.1且Linux运行PHP 7.0的Windows上运行良好。看看我的代码,看起来我没有使用7.1中的任何功能,而且不是7.0。

如果我自己调用这个方法它可以正常工作,当它在我的其他代码中使用时,它似乎根本不运行。

public function titleRegex($title){
    $re = "/^.+?(?=\\s*[(.]?(\\d{4}))/mi";
    $str = "$title";

    if(preg_match_all($re, $str, $matches) != null) {

        if (!empty($matches[0])) {

            $arrayString =  implode('', $matches[0]);

            return $arrayString;
        }
    }

    return $title;
}
 $title = pathinfo($name, PATHINFO_FILENAME);
 $regexTitle = $this->titleRegex($title);
 $imdbQuery = $this->imdbScraper($regexTitle);
 $location = base64_encode(pathinfo($name, PATHINFO_DIRNAME));
 // SQL Data is here

当我运行directoryscanner时,它尝试没有正则表达式,如果我自己调用正则表达式方法并将自己的值传递给它,它工作正常。此外,我已经安装了PHP7.0-curl,当我对所有电影标题进行卷曲请求时,它什么也没有返回...但是如果我自己调用该方法就可以了。我完全迷失了可能造成这种情况的原因。

0 个答案:

没有答案