Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [stdClass Object] w pętli foreach błąd.
zeroszumu
post 29.12.2011, 14:27:59
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 5.11.2011

Ostrzeżenie: (0%)
-----


Witam, mam taki problem.

Zmienna o nazwie $attachments zwraca wartości obiektu:

  1. stdClass Object
  2. (
  3. [ID] => 73
  4. [post_author] => 1
  5. [post_date] => 2011-12-29 09:47:46
  6. [post_date_gmt] => 2011-12-29 09:47:46
  7. [post_content] =>
  8. [post_title] => i2
  9. [post_excerpt] =>
  10. [post_status] => inherit
  11. [comment_status] => open
  12. [ping_status] => open
  13. [post_password] =>
  14. [post_name] => i2
  15. [to_ping] =>
  16. [pinged] =>
  17. [post_modified] => 2011-12-29 09:47:46
  18. [post_modified_gmt] => 2011-12-29 09:47:46
  19. [post_content_filtered] =>
  20. [post_parent] => 71
  21. [guid] => [url="http://XXX/projekty/XXX/wp-content/uploads/2011/12/i2.png"]http://XXX/projekty/XXX/wp-conte.../2011/12/i2.png[/url]
  22. [menu_order] => 0
  23. [post_type] => attachment
  24. [post_mime_type] => image/png
  25. [comment_count] => 0
  26. [filter] => raw
  27. )


chce ją dać do pętli:

  1. foreach($attachments as $big){
  2. print_r($big);
  3. }


i wywala mi błąd ;(

Kod
Fatal error: Cannot use object of type stdClass as array in /home/XXX/domains/XXX/public_html/projekty/XXX/wp-content/plugins/file-gallery/templates/default/gallery.php on line 3


proszę o pomoc/wskazówkę w czym tkwi błąd smile.gif

Ten post edytował zeroszumu 29.12.2011, 14:28:51
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.06.2025 - 17:28