オブジェクト以外のエラーのプロパティを取得しようとし続ける理由を理解しようとしています。私が作成した配列を使用します。私は配列を作成し、それを予測しています。オブジェクト配列の外観から、これらのプロパティは存在します。
この領域でエラーが発生しています:
// Separates each of the last 5 pesonal messages
foreach ($last_5_personal_messages AS $message)
{
echo '<li>';
echo '<span class="icon avatar"><img src="'.$message->sender_avatar.'" alt="" /></span>';
echo '<span class="name"><a href="'.$site_url.'/personalmessages/viewmessage/'.$message->message_id.'"><strong>'.$message->sender_name.'</strong></a><span class="time">'.$message->datetime_sent.' ago</span></span>';
echo '<span class="msg">'.$message->subject.'</span>';
echo '</li>';
}
?>
Array
(
[0] => stdClass Object
(
[message_id] => 1
[subject] => Test Message
[datetime_sent] => 2 weeks
[attachments] =>
[priority] => 0
[message_content] => Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
[message_read] => 0
[is_favorite] => 0
[sender_name] => Mike Scott
[sender_email_address] => myemail@myemail.com
[sender_avatar] => http://dev.myserver.com/assets/themes/supr/images/avatars/avatar5.jpg
)
[1] => stdClass Object
(
[message_id] => 2
[subject] => Testing PM Message
[datetime_sent] => 3 weeks
[attachments] => Array
(
[0] => Array
(
[file_name] => file1.jpg
[is_file] => 1
[file_size] => 7.01 KB
[file_location] => assets/downloads/file1.jpg
)
[1] => Array
(
[file_name] => file2.jpg
[is_file] =>
)
[2] => Array
(
[file_name] => file3.jpg
[is_file] =>
)
)
[priority] => 0
[message_content] => This is jsut a test of the personal message system!
[message_read] => 0
[is_favorite] => 0
[sender_name] => Kevin Scott
[sender_email_address] => myemail@server.com
[sender_avatar] => http://dev.myserver.com/assets/themes/supr/images/avatars/avatar5.jpg
)
[2] => stdClass Object
(
[message_id] => 3
[subject] => Testing Whatever
[datetime_sent] => 1 week
[attachments] =>
[priority] => 0
[message_content] => Testing Message Content
[message_read] => 0
[is_favorite] => 0
[sender_name] => Frank Scott
[sender_email_address] => frankscott@testemail.com
[sender_avatar] => http://dev.myserver.com/assets/themes/supr/images/avatars/avatar.jpg
)
[total_unread_messages] => 3
)