在变量中加载图像PHP

时间:2016-11-04 11:33:15

标签: php image

我想知道如何使用以下变量在php中加载图像:

<?php 

foreach (glob('cam/*.jpg') as $f) {
    # store the image name
    $list[] = $f;
}

sort($list);             # sort is oldest to newest,

echo array_pop($list);   # Newest
?>

如何从array_pop($list)加载图像文件?

1 个答案:

答案 0 :(得分:0)

<?php 

foreach (glob('cam/*.jpg') as $f) {
    # store the image name
    $list[] = $f;
}

sort($list);                    # sort is oldest to newest,

echo '<img src="'.array_pop($list).'">';

&GT;