警告 glob() 期望参数 2 太长

warning glob() expects parameter 2 to be to long

当我导航到我网站上的图库页面时,相册缩略图上方有我将在下方键入的错误消息。

warning glob() expects parameter 2 to be to long, string blah blah blah on line 237

我使用的是 FolioGallery 2.0 版。 http://www.foliopages.com/php-jquery-ajax-photo-gallery-no-database

FolioGallery.php http://pastebin.com/R77yYBuA

我不确定我的主机使用的 PHP 是哪个版本,但在我用来本地测试我的网站的本地网络托管机器上它工作正常。我确定我的本地主机 PHP 版本比我的主机 PHP 版本更新。有什么方法可以让它在旧的 PHP 版本上运行吗?

这就是我用来调用 FolioGallery 的名称

            <!-- Start Gallery -->
            <div class="php-gallery">
            <?php include('foliogallery-demo2.php'); ?>
            </div>
            <!-- End Gallery -->

FolioGallery-demo2.php http://pastebin.com/vka1zJiA

脚本和其他相关文件可以从我上面提供的 FolioGallery link 下载。

您可以使用循环代替大括号:

$thumb_pool = array();
foreach ($extensions as $ext) {
    $temp = glob($mainFolder.'/'.$albums[$i].'/thumbs/*'.$ext);
    $thumb_pool = array_merge($thumb_pool, $temp);
}

替换

$thumb_pool = glob($mainFolder.'/'.$albums[$i].'/thumbs/*{.'.implode(",",$extensions).'}', GLOB_BRACE);

//$thumb_pool = glob($mainFolder.'/'.$albums[$i].'/thumbs/*{.'.implode(",",$extensions).'}', GLOB_BRACE);

$thumb_pool = glob($mainFolder.'/'.$albums[$i].'/thumbs/*.jpg');