php如何构造数组
ringa_lee
ringa_lee 2017-04-10 17:27:52
0
3
566
$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

membalas semua(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

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan