php如何构造数组
ringa_lee
ringa_lee 2017-04-10 17:27:52
0
3
553
$arr = array(
foreach ($list->list as $json) {
"file"=>str_replace('99552', '', $json->path)
}
);

我这样写提示Parse error: syntax error, unexpected T_FOREACH, expecting ')',该如何修改?

ringa_lee
ringa_lee

ringa_lee

reply all(3)
伊谢尔伦
$arr = array(); 
foreach ($list->list as $json) 
{
$arr[] = array(
"file"=>str_replace('99552', '', $json->path);
); 
}
大家讲道理
$arr = array(); 
foreach ($list->list as $json) 
{
    $arr[] = str_replace('99552', '', $json->path);
}
var_dump($arr);

即可。

迷茫

新手路过学习一下,感谢bio.soyiyuan.com

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!