我确定这对于专家来说是微不足道的,我只是不知道如何完全做到这一点。PHP将for循环添加到对象中
我有一个for循环
for ($x = 1; $x <= $picCount; $x++) {
$finalUrl = $picUrl.$gsi.'&picfilename='.$vin.'_'.sprintf('%03d', $x) .'.jpg';
}
我想要做的就是添加每个$ finalUrl对象或数组。我怎么做?最终目的的
实施例:
stdClass Object
(
[title] => Blah
[test] => w00t!
[picUrl] => array(
http://example.com/image/xx1.jpg
http://example.com/image/xx2.jpg
http://example.com/image/xx3.jpg
http://example.com/image/xx4.jpg
)
)
请提供你想要得到的结果的一个例子。 –
添加了一个示例。请原谅糟糕的格式化.... – lz430
所以你基本上是问如何给数组添加一个值?你读过任何[文档](https://secure.php.net/manual/en/language.types.array.php)或者至少[搜索堆栈溢出](https://stackoverflow.com/search?q =%5Bphp%5D +添加+值+至+数组)? –