如何將屬性添加到數組對象變量? 比方說,我有可變對象是這樣的:將屬性變量添加到對象數組php
Array
(
[0] => stdClass Object
(
[category] => Nuklir
[id] => 715
[title] => Testing Article Nuklir
[alias] => testing-article-nuklir
[title_alias] =>
[introtext] => <p><span style="color: #666666; font-family: 'Lucida Grande', Arial, sans-serif; font-size: 13px; line-height: 19px;" mce_style="color: #666666; font-family: 'Lucida Grande', Arial, sans-serif; font-size: 13px; line-height: 19px;">Vivamus libero eros, dictum id aliquam in, tristique id sapien. Maecenas rhoncus malesuada aliquet. Morbi vulputate vulputate mauris quis condimentum. Ut ut ligula et mauris accumsan tristique ut nec lacus.</span></p><p><span style="color: #666666; font-family: 'Lucida Grande', Arial, sans-serif; font-size: 13px; line-height: 19px;" mce_style="color: #666666; font-family: 'Lucida Grande', Arial, sans-serif; font-size: 13px; line-height: 19px;">Vivamus libero eros, dictum id aliquam in, tristique id sapien. Maecenas rhoncus malesuada aliquet. Morbi vulputate vulputate mauris quis condimentum. Ut ut ligula et mauris accumsan tristique ut nec lacus.</span></p><p><span style="color: #666666; font-family: 'Lucida Grande', Arial, sans-serif; font-size: 13px; line-height: 19px;" mce_style="color: #666666; font-family: 'Lucida Grande', Arial, sans-serif; font-size: 13px; line-height: 19px;">Vivamus libero eros, dictum id aliquam in, tristique id sapien. Maecenas rhoncus malesuada aliquet. Morbi vulputate vulputate mauris quis condimentum. Ut ut ligula et mauris accumsan tristique ut nec lacus.</span><br /></p>
[fulltext] =>
[sectionid] => 7
[state] => 1
[catid] => 25
[created] => 2012-12-10 07:51:03
[created_by] => 110
[created_by_alias] =>
[modified] => 0000-00-00 00:00:00
[modified_by] => 0
[checked_out] => 0
[checked_out_time] => 0000-00-00 00:00:00
[publish_up] => 2012-12-10 07:51:03
[publish_down] => 0000-00-00 00:00:00
[hits] => 0
[images] =>
[urls] =>
[ordering] => 1
[metakey] =>
[metadesc] =>
[access] => 0
[slug] => 715:testing-article-nuklir
[catslug] => 25:nuklir
[readmore] => 0
[author] => migrasi
[usertype] => Super Administrator
[groups] => Public
[author_email] => [email protected]
)
)
我想在這裏什麼,是添加新的特性如。 [site_id] => 1 [author_email]下方。可能嗎?
對象屬性沒有特別排序(儘管數組鍵是...),但是你有一個索引爲[[0]''so'$ yourvar [0] - > site_id = 1;' –