Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.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
Javascript 超大-在PHP中从多级数组中读取特定值_Javascript_Php_Arrays_Slideshow - Fatal编程技术网

Javascript 超大-在PHP中从多级数组中读取特定值

Javascript 超大-在PHP中从多级数组中读取特定值,javascript,php,arrays,slideshow,Javascript,Php,Arrays,Slideshow,我有一个JavaScript幻灯片,可以从文件夹中读取图片,我需要从.dat文件中读取每个图片的描述。 以下是脚本: <?php require ('macoola.inc'); $upload = new images_upload('installations/', 3000000, 'info.dat'); $photo_list = $upload->read_data(); #this gets unserialized values fr

我有一个JavaScript幻灯片,可以从文件夹中读取图片,我需要从.dat文件中读取每个图片的描述。 以下是脚本:

    <?php

    require ('macoola.inc');
    $upload = new images_upload('installations/', 3000000, 'info.dat');
    $photo_list = $upload->read_data(); #this gets unserialized values from info.dat

#read all jpegs in the folder
    $path_userspecific_array = explode(";", $_SESSION['userDirs']);
    $images_splice = null;
    settype($images_splice, "array");
    foreach($path_userspecific_array as $thisdir){ 
    $thispath = ('installations/' . $thisdir);
    $thisimages = null;
    $thisimages = glob($thispath.'/{*.jpg,*.JPG,*.jpeg,*.JPEG}', GLOB_BRACE);
    $images_splice = array_merge($images_splice, $thisimages);
    }
    ?>

下面是java:

 {
    image: '<?php
    echo $filename ?>',
    title: '<?php   
    **#show description here**
    ?>',
thumb : '<?php                                                                      echo $filename                                                                          ?>'
                                                                 }
{
图像:“”,
标题:“”,
拇指:''
}

提前谢谢。

我终于解决了这个问题!解决方法非常简单。 我没有使用其他脚本读取文件夹中的图像,而是直接从.dat文件中提取了图片和说明的链接,如以下代码所示:

<?php

require ('macoola.inc');
$upload = new images_upload('url/', 3000000, 'info.dat');
$photo_list = $upload->read_data();
$photo_url = "url/";

?>

然后用foreach函数打印我需要的字符串,并将其放入超大尺寸的“幻灯片”字段中:

<?php                                            
foreach ($photo_list as $key=>$val){
$input .= " image: '".$photo_url.$key."', title: '".$val['desc']."', thumb : '',";
?> 
                                                        { <?php echo $input; ?> },
<?php } ?>