Php数组显示多数组的第一个值

时间:2018-04-25 09:07:26

标签: php

我知道这是一个简单的问题,但我无法弄清楚。

如何才能显示此阵列中的第一个值(文件未上传)?阵列可以是不同的!所以$ test [fileUploadFileErrorNoFile]不是sollution。

$test = Array ( [fileUploadFileErrorNoFile] => File was not uploaded 
                [fileMimeTypeNotReadable] => File is not readable or does not exist 
                [fileIsImageNotReadable] => File is not readable or does not exist 
                [fileImageSizeNotReadable] => File is not readable or does not exist 
            )

2 个答案:

答案 0 :(得分:0)

试试这个:

$test = Array (   "[fileIsImageNotReadable] => File is not readable or does not exist", "[fileImageSizeNotReadable] => File is not readable or does not exist" );


echo $test[0]; // 0 == the first value

答案 1 :(得分:0)

你的阵列看起来像这样吗?

echo $test[0][fileUploadFileErrorNoFile];

然后答案是:

{{1}}