【发布时间】:2017-12-08 13:36:04
【问题描述】:
您好,我的脚本中有这个数组。这是我的数组
Array
(
[0] => Array
(
[0] => BACK
[1] => PACK
[2] => BBP160800103
[3] =>
[4] => G086-1
[5] => 8#.JPG
)
[2] => Array
(
[0] => BACKPACK
[1] => BBP160500010
[2] => G114-3#1.JPG
)
[3] => Array
(
[0] => WSL160800024-WSL160800025
[1] => L83-5.JPG
)
[4] => Array
(
[0] => IA041017
[1] => L83-5.JPG
)
)
我从这个脚本中得到了数组。我正在使用 codeigniter 3
public function generatenewname(){
$this->load->helper('directory');
$map = directory_map( './assets/file_upload/md/temp/',FALSE, TRUE);
for($x=0;$x<count($map);$x++){
$newest[$x] = explode(" ",$map[$x]);
}
echo "<pre>";print_r($newest);
}
所以从上面的数组中我想得到这个值BBP160800103,BBP160500010,WSL160800024,WSL160800025 和IA041017 我怎样才能实现它?
--更新--
我从我的脚本中做了一些更新(我正在尝试)
public function generatenewname(){
$this->load->helper('directory');
$map = directory_map( './assets/file_upload/md/temp/',FALSE, TRUE);
for($x=0;$x<count($map);$x++){
$newest[$x] = explode(" ",$map[$x]);
for($y=0;$y<count($newest[$x]);$y++){
if(strlen($newest[$x][$y]) >= 7){
$file[] =$newest[$x][$y];
}
}
}
for($x=0;$x<count($file);$x++){
echo $x.' '. $file[$x].'<br>';
}
}
对于我上面的脚本,我在我的列表中得到了这个
[n] BBP160800103
[n] BBP160500010
[n] WSL160800024-WSL160800025
我想实现它
[n] BBP160800103
[n] BBP160500010
[n] WSL160800024
[n] WSL160800025
【问题讨论】:
标签: php arrays codeigniter