-1

次の変数があり、配列ループで使用する必要があります...

$jointa="'nike-score', 'pack-cupcake', 'shor-burgundy'";

foreach (array($jointa) as $id) {
    $yourSiteContent[] = array('permalink' => $id, 'updated' => $dated);
}

しかし、配列ループに直接値を入れると、正常に動作します....

foreach (array('nike-score', 'pack-cupcake', 'shor-burgundy') as $id) {
    $yourSiteContent[] = array('permalink' => $id, 'updated' => $dated);
}

私が間違いをしている場所を確認してください。

4

2 に答える 2

5
$jointa = array('nike-score', 'pack-cupcake', 'shor-burgundy');

foreach ($jointa as $id) {
    $yourSiteContent[] = array('permalink' => $id, 'updated' => $dated);
}
于 2012-08-24T00:06:12.557 に答える
0
$jointa = array('nike-score', 'pack-cupcake', 'shor-burgundy');


foreach ($jointa as $key => $value)
{
    echo($key . " = " . $value)
}
于 2012-08-24T00:07:11.817 に答える