Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

2 Stron V   1 2 >  
Reply to this topicStart new topic
> [php] Warning: Cannot modify header information - headers already sent by..., nie lada zagadka
Jarod
post 24.11.2007, 20:41:53
Post #1





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Piszę tego posta w tym dziale, bo sam nie wiem w czym problem - na pewno nie w php. Korzystam z apache 2.0.58 i php 5.2.0.

Mam dosyć dużą aplikację, która została tak zaprojektowana, że wszystkie headery wysyłam na samym początku, zbudowana o wzorzec MVC. Jakiś czas temu potrzebowałem kalendarz w JS i znalazłem pod adresem: http://www.kubiczek.biz/uploaded/datetimepicker.zip

Po dodaniu dwóch linijek aplikacj sypie błędami (...)headers already sent(...) Szczerze - nie wiem w czym problem..

Przy poniższym kodzie brak problemów
  1. <link rel="stylesheet" href="Css/main.css" type="text/css" />
  2. <!--[if gte IE 6]><link rel="stylesheet" href="Css/main_ie.css" type="text/css" /><![endif]-->
  3. <script type="text/javascript" src="Js/PopUp.js"></script>


Przy poniższym kodzie występuję błąd jak w tytule posta
  1. <link rel="stylesheet" href="Css/main.css" type="text/css" />
  2. <!--[if gte IE 6]><link rel="stylesheet" href="Css/main_ie.css" type="text/css" /><![endif]-->
  3. <script type="text/javascript" src="Js/PopUp.js"></script>
  4. <link rel="stylesheet" href="Css/DateTimePicker.css" type="text/css" />
  5. <script type="text/javascript" src="Js/DateTimePicker.js"></script>



Przy poniższym kodzie brak problemów
  1. <link rel="stylesheet" href="Css/main.css" type="text/css" />
  2. <script type="text/javascript" src="Js/PopUp.js"></script>
  3. <link rel="stylesheet" href="Css/DateTimePicker.css" type="text/css" />
  4. <script type="text/javascript" src="Js/DateTimePicker.js"></script>


Proszę o pomoc


EDIT:


Przeprowadziłem małe testy.. Wyniki są dla mnie zaskakujące - nie potrafię ich racjonalnie wytłumaczyć..

Brak błędu headers...
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  3. <?php echo '<base href="http://' . $_SERVER['HTTP_HOST'] . Config::$SystemPath . '" />'; ?>
  4. <link rel="stylesheet" href="Css/main.css" type="text/css" />
  5. <link rel="stylesheet" href="Css/main1.css" type="text/css" />
  6. <link rel="stylesheet" href="Css/main2.css" type="text/css" />
  7. <link rel="stylesheet" href="Css/main3.css" type="text/css" />
  8. <link rel="stylesheet" href="Css/main4.css" type="text/css" />
  9. <link rel="stylesheet" href="Css/main5.css" type="text/css" />
  10. <link rel="stylesheet" href="Css/main6.css" type="text/css" />
  11. <link rel="stylesheet" href="Css/main7.css" type="text/css" />
  12. <link rel="stylesheet" href="Css/main8.css" type="text/css" />
  13. <link rel="stylesheet" href="Css/main9.css" type="text/css" />
  14.  
  15. <title>TransBag</title>
  16. </head>


Błąd headers already sent...
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  3. <?php echo '<base href="http://' . $_SERVER['HTTP_HOST'] . Config::$SystemPath . '" />'; ?>
  4. <link rel="stylesheet" href="Css/main.css" type="text/css" />
  5. <link rel="stylesheet" href="Css/main1.css" type="text/css" />
  6. <link rel="stylesheet" href="Css/main2.css" type="text/css" />
  7. <link rel="stylesheet" href="Css/main3.css" type="text/css" />
  8. <link rel="stylesheet" href="Css/main4.css" type="text/css" />
  9. <link rel="stylesheet" href="Css/main5.css" type="text/css" />
  10. <link rel="stylesheet" href="Css/main6.css" type="text/css" />
  11. <link rel="stylesheet" href="Css/main7.css" type="text/css" />
  12. <link rel="stylesheet" href="Css/main8.css" type="text/css" />
  13. <link rel="stylesheet" href="Css/main9.css" type="text/css" />
  14. <link rel="stylesheet" href="Css/main10.css" type="text/css" />
  15.  
  16. <title>TransBag</title>
  17. </head>


Czy jest ograniczona ilość znaczników meta/itp, którą można zamieścić w sekcji head ?

Ten post edytował nospor 4.12.2007, 10:26:05


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
webdice
post 24.11.2007, 22:22:26
Post #2


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Błąd wyskakuje bo wysyłasz coś do przeglądarki (print, echo) lub tworzysz cookie, przed wysłaniem nagłówków. Najszybszym rozwiązaniem jest użycie ob_start" title="Zobacz w manualu PHP" target="_manual.
Go to the top of the page
+Quote Post
Jarod
post 24.11.2007, 22:28:09
Post #3





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Cytat(webdicepl @ 24.11.2007, 22:22:26 ) *
Błąd wyskakuje bo wysyłasz coś do przeglądarki (print, echo) lub tworzysz cookie, przed wysłaniem nagłówków. Najszybszym rozwiązaniem jest użycie ob_start" title="Zobacz w manualu PHP" target="_manual.


Proponuje przeczytać dokładnie to co napisałem a nie klepać gotowych rozwiązań przeczytanych w innych postach.


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
webdice
post 24.11.2007, 22:41:24
Post #4


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Z treści błędu jasno wynika że coś wcześniej zostało wysłane do przeglądarki i nie wydaje mi się żeby to co napisałeś powodowało błąd.

P. S. Nie dość że próbuje Ci pomóc to jeszcze mnie oskarżasz o "klepanie gotowych rozwiązań przeczytanych w innych postach". Równie dobrze mógłbym powiedzieć że bezmyślnie skopiowałeś skopiowałeś kalendarz i nie umiesz umieścić go na stronie.
Go to the top of the page
+Quote Post
Jarod
post 24.11.2007, 22:51:09
Post #5





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Cytat(webdicepl @ 24.11.2007, 22:41:24 ) *
Z treści błędu jasno wynika że coś wcześniej zostało wysłane do przeglądarki i nie wydaje mi się żeby to co napisałeś powodowało błąd.

P. S. Nie dość że próbuje Ci pomóc to jeszcze mnie oskarżasz o "klepanie gotowych rozwiązań przeczytanych w innych postach". Równie dobrze mógłbym powiedzieć że bezmyślnie skopiowałeś skopiowałeś kalendarz i nie umiesz umieścić go na stronie.


Klepiesz gotowe rozwiązania. Mało tego myślę że nabijasz posty. Gdybyś przeczytał to co napisałem szczególnie bo pogrubionym napisie "EDIT:" to zauważyłbyś że z kalendarzem nie ma to nic wspólnego. Z testów wynika, że w <head> po umieszczeniu jednego wpisu więcej zaczyna pojawiać się błąd. Pozostały kod pozostał bez zmian. Więc wcześniej nic nie mogłem wysłać do przeglądarki, skoro raz działa a raz nie. Pomyśl logicznie. Doceniam to że starasz się pomóc ale staraj się także czytać dokładnie i analizować fakty a nie zakładać z góry, że skoro pojawia się taki błąd to jedynym rozwiązaniem jest ob_start. Bo tak się składa, że to nie jest rozwiązanie. Równie dobrze mógłbym wyłączyć wyświetlanie błędów w pliku konfiguracyjnym. Ale nie tędy droga.

pzdr

Ten post edytował Jarod 24.11.2007, 22:52:52


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
Daimos
post 25.11.2007, 01:52:33
Post #6





Grupa: Zarejestrowani
Postów: 1 319
Pomógł: 118
Dołączył: 26.11.2003
Skąd: Lublin

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


to musi byc wina wysylanych naglowkow przez PHP, nie wiem czego tak wjezdzasz na webdice
html Ci tego nie wyrzuci
  1. <?php echo '<base href="http://' . $_SERVER['HTTP_HOST'] . Config::$SystemPath . '" />'; ?>

po wywaleniu tej linii zapewne bledu nie bedzie
cos namieszales

wylaczajac bledy, nie rozwiazesz problemu z naglowkami, nie beda przekazywane, tylko blad sie nie wyswietli
z uzyciem ob_start()... nie bedzie bledu, no i naglowki pojda


--------------------
scriptun.com. Startup z poradnikami do gier ttp.zone i ttpzone.pl
Go to the top of the page
+Quote Post
Jarod
post 25.11.2007, 02:01:50
Post #7





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Cytat(my salsa @ 25.11.2007, 01:52:33 ) *
to musi byc wina wysylanych naglowkow przez PHP, nie wiem czego tak wjezdzasz na webdice
html Ci tego nie wyrzuci
  1. <?php echo '<base href="http://' . $_SERVER['HTTP_HOST'] . Config::$SystemPath . '" />'; ?>

po wywaleniu tej linii zapewne bledu nie bedzie
cos namieszales

Po wywaleniu tej linijki błędy nadal są..

Cytat(my salsa @ 25.11.2007, 01:52:33 ) *
z uzyciem ob_start()... nie bedzie bledu, no i naglowki pojda

Nie satysfakcjonuje mnie takie rozwiązanie.


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
Daimos
post 25.11.2007, 03:11:02
Post #8





Grupa: Zarejestrowani
Postów: 1 319
Pomógł: 118
Dołączył: 26.11.2003
Skąd: Lublin

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


nie pokazujesz nam chyba calego kodu, cos tam musi jeszcze siedziec winksmiley.jpg


--------------------
scriptun.com. Startup z poradnikami do gier ttp.zone i ttpzone.pl
Go to the top of the page
+Quote Post
Jarod
post 25.11.2007, 12:06:06
Post #9





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Cytat(my salsa @ 25.11.2007, 03:11:02 ) *
nie pokazujesz nam chyba calego kodu, cos tam musi jeszcze siedziec winksmiley.jpg


Cały kod? Masz czas na analizowanie ponad 300 plików z klasami?winksmiley.jpg Dobra tak poważnie dzisiaj wstałem, wypoczęty i znalazłem miejsce gdzie mogłem popełnić błąd - cała problem sprowadzał się do tego, że skutki tego błędu ujawniły się po dodaniu w sekcji <head> dwóch linijek...

Zrobiłem kolejny test.. Sprawdźcie sami..

index.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <meta http-equiv="Content-Language" content="pl" />
  5. <meta name="Description" content="Description" />
  6. <meta name="Author" content="Author" />
  7. <meta name="Robots" content="all" />
  8. <meta name="Pragma" content="no-cache" />
  9. <meta name="Cache-Control" content="no-store, no-cache, must-revalidate" />
  10.  
  11. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  12. <!--[if gte IE 6]><link rel="stylesheet" href="Css/t1_ie.css" type="text/css" /><![endif]-->
  13. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  14. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  15. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  16. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  17. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  18. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  19. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  20. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  21. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  22. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  23. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  24. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  25. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  26. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  27. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  28. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  29. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  30. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  31. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  32. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  33. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  34. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  35. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  36. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  37. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  38. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  39. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  40. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  41. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  42. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  43. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  44. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  45. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  46. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  47. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  48. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  49. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  50. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  51. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  52. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  53. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  54. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  55. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  56. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  57. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  58. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  59. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  60. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  61. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  62. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  63. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  64. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  65. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  66. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  67.  
  68. <title>Tytuł</title>
  69. </head>
  70. <?php
  71. header('Location: http://www.interia.pl');
  72. ?>
  73. </body>
  74. </html>


Komunikat "Warning: Cannot modify header information - headers already sent by...". Usuńcie jedną linijkę <link style...> i wszystko jest ok. Kto mi to wytłumaczy? Sprawdzałem najnowszą wersję php i apache (myślałem że to jakiś bug..)


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
webdice
post 25.11.2007, 12:23:59
Post #10


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Daj zipa z wszystkim tak żeby można było to łatwo uruchomić.
Go to the top of the page
+Quote Post
SirZooro
post 25.11.2007, 13:05:49
Post #11





Grupa: Zarejestrowani
Postów: 243
Pomógł: 32
Dołączył: 14.06.2007

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


W tym ostatnim przykładzie wywołujesz funkcję header() w sekcji <body>, gdy już kawał HTML'a został wysłany. Przenieś to na sam początek i profilaktycznie dodaj po nim jeszcze funkcję exit() - powinno pomóc. Ew. pobaw się z buforowaniem strony.


--------------------
Go to the top of the page
+Quote Post
Jarod
post 25.11.2007, 17:12:45
Post #12





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


@webdicepl: Nie mogę - kod nie jest darmowy. Przetestuj na ostatnim kawałku kodu który podałem - bardzo prosty test.

@SirZooro: Funkcję header() specjalnie umieściłem w body.. Bo nie rozumiem dlaczego raz wywala błąd a raz nie.. Tak jakby to było uzależnione od ilości danych w sekcji <head>. Czy ktoś to potrafi wytłumaczyć. Pomińcie pierwsze przykłady. Przetestujcie ostatni, który podałem.


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
kevinsz
post 25.11.2007, 19:20:20
Post #13





Grupa: Zarejestrowani
Postów: 23
Pomógł: 2
Dołączył: 26.04.2007

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


Myślę, że bez podania choćby kawałka kodu nikt Ci nie pomoże. To, co piszesz jest delikatnie mówiąc "absurdalne". W Twoim ostatnim przykładzie choćby nie wiem co się zamieściło przed wywołaniem header() to zawsze będzie błąd. Wystarczy, że będzie tam tylko spacja! I nie chodzi mi tu o kod HTML, który nie ma nic wspólnego z tym błędem, tylko o PHP;)
Go to the top of the page
+Quote Post
Jarod
post 25.11.2007, 21:11:39
Post #14





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


smile.gif Wiecie co? Oglądałem przed chwilką film 1408. Czytając tego posta odnoszę wrażenie że znalazłem się w takim pokoju:)
Przecież zamieściłem kod.. W swoim programie powiedzmy, że miałem błąd (już wiem gdzie) ale nie zauważyłem go, bo dopóki nie dodałem kolejnego wpisu w sekcji <head> nie wyświetlał się...

Koledzy utwórzcie plik index.php o takiej zawartości.
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <meta http-equiv="Content-Language" content="pl" />
  5. <meta name="Description" content="Description" />
  6. <meta name="Author" content="Author" />
  7. <meta name="Robots" content="all" />
  8. <meta name="Pragma" content="no-cache" />
  9. <meta name="Cache-Control" content="no-store, no-cache, must-revalidate" />
  10.  
  11. <link rel="stylesheet" href="Css/t1.css" type="text/css" />
  12. <!--[if gte IE 6]><link rel="stylesheet" href="Css/t1_ie.css" type="text/css" /><![endif]-->
  13. <link rel="stylesheet" href="Css/t2.css" type="text/css" />
  14. <link rel="stylesheet" href="Css/t3.css" type="text/css" />
  15. <link rel="stylesheet" href="Css/t4.css" type="text/css" />
  16. <link rel="stylesheet" href="Css/t5.css" type="text/css" />
  17. <link rel="stylesheet" href="Css/t6.css" type="text/css" />
  18. <link rel="stylesheet" href="Css/t7.css" type="text/css" />
  19. <link rel="stylesheet" href="Css/t8.css" type="text/css" />
  20. <link rel="stylesheet" href="Css/t9.css" type="text/css" />
  21. <link rel="stylesheet" href="Css/t10.css" type="text/css" />
  22. <link rel="stylesheet" href="Css/t11.css" type="text/css" />
  23. <link rel="stylesheet" href="Css/t12.css" type="text/css" />
  24. <link rel="stylesheet" href="Css/t13.css" type="text/css" />
  25. <link rel="stylesheet" href="Css/t14.css" type="text/css" />
  26. <link rel="stylesheet" href="Css/t15.css" type="text/css" />
  27. <link rel="stylesheet" href="Css/t16.css" type="text/css" />
  28. <link rel="stylesheet" href="Css/t17.css" type="text/css" />
  29. <link rel="stylesheet" href="Css/t18.css" type="text/css" />
  30. <link rel="stylesheet" href="Css/t19.css" type="text/css" />
  31. <link rel="stylesheet" href="Css/t20.css" type="text/css" />
  32. <link rel="stylesheet" href="Css/t21.css" type="text/css" />
  33. <link rel="stylesheet" href="Css/t22.css" type="text/css" />
  34. <link rel="stylesheet" href="Css/t23.css" type="text/css" />
  35. <link rel="stylesheet" href="Css/t24.css" type="text/css" />
  36. <link rel="stylesheet" href="Css/t25.css" type="text/css" />
  37. <link rel="stylesheet" href="Css/t26.css" type="text/css" />
  38. <link rel="stylesheet" href="Css/t27.css" type="text/css" />
  39. <link rel="stylesheet" href="Css/t28.css" type="text/css" />
  40. <link rel="stylesheet" href="Css/t29.css" type="text/css" />
  41. <link rel="stylesheet" href="Css/t30.css" type="text/css" />
  42. <link rel="stylesheet" href="Css/t31.css" type="text/css" />
  43. <link rel="stylesheet" href="Css/t32.css" type="text/css" />
  44. <link rel="stylesheet" href="Css/t33.css" type="text/css" />
  45. <link rel="stylesheet" href="Css/t34.css" type="text/css" />
  46. <link rel="stylesheet" href="Css/t35.css" type="text/css" />
  47. <link rel="stylesheet" href="Css/t36.css" type="text/css" />
  48. <link rel="stylesheet" href="Css/t37.css" type="text/css" />
  49. <link rel="stylesheet" href="Css/t38.css" type="text/css" />
  50. <link rel="stylesheet" href="Css/t39.css" type="text/css" />
  51. <link rel="stylesheet" href="Css/t40.css" type="text/css" />
  52. <link rel="stylesheet" href="Css/t41.css" type="text/css" />
  53. <link rel="stylesheet" href="Css/t42.css" type="text/css" />
  54. <link rel="stylesheet" href="Css/t43.css" type="text/css" />
  55. <link rel="stylesheet" href="Css/t44.css" type="text/css" />
  56. <link rel="stylesheet" href="Css/t45.css" type="text/css" />
  57. <link rel="stylesheet" href="Css/t46.css" type="text/css" />
  58. <link rel="stylesheet" href="Css/t47.css" type="text/css" />
  59. <link rel="stylesheet" href="Css/t48.css" type="text/css" />
  60. <link rel="stylesheet" href="Css/t49.css" type="text/css" />
  61. <link rel="stylesheet" href="Css/t50.css" type="text/css" />
  62. <link rel="stylesheet" href="Css/t51.css" type="text/css" />
  63. <link rel="stylesheet" href="Css/t52.css" type="text/css" />
  64. <link rel="stylesheet" href="Css/t53.css" type="text/css" />
  65. <link rel="stylesheet" href="Css/t54.css" type="text/css" />
  66.  
  67. <title>Tytuł</title>
  68. </head>
  69. <?php
  70. echo 'test';
  71. header('Location: http://www.google.pl');
  72. ?>
  73. </body>
  74. </html>


i odpalcie go. Powinien pojawić się błąd "Headers already sent...". I bardzo dobrze - bo próbuję wysłać nagłówek po tym, jak wyświetliłem w przeglądarce tekst... A teraz z tego samego pliku, z sekcji <head> usuńcie wpis <link rel="stylesheet" href="Css/t54.css" type="text/css" />
i odpalcie w przeglądarce jeszcze raz plik index.php. Teraz zostaniecie przekierowani na stronę googla.. Dlaczego? Przecież dalej wysyłam nagłówek po wyświetleniu w przeglądarce tekstu "test"... Chciałbym, żeby ktoś mi wytłumaczył dziwne zachowanie php, opierając się na tym przykładzie... Nie proszę o nic innego tylko o skopiowanie powyższego kodu i wklejenie go do pliku index.php i przetestowaniu.. Nie wiem jeszcze jak to wytłumaczyć.. Mam nagrać filmik?


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
phpion
post 25.11.2007, 21:16:45
Post #15





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




Hmmm mnie od razu przenosi na google, nic nie muszę usuwać. Nie powiem, ciekawe smile.gif

OT & Edit:
Hmmm teraz zauważyłem, że przestało mi się wyświetlać "Cannot modify..." :| wszelkie display_errors mam włączone. Może gdy swego czasu aktualizowałem PHP do 5.2.4 to wtedy coś się namieszało?

Ten post edytował phpion.com 25.11.2007, 21:26:58
Go to the top of the page
+Quote Post
Jarod
post 25.11.2007, 21:49:34
Post #16





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Mam włączone wyświetlanie wszystkich błędów + E_STRICT. Zmieniałem php na najnowszą wersję i apacha także. Zachowanie pozostaje takie samo. Dla niedowiarków do pobrania filmik (spakowany zipem).

Filmik

Wirtualna gorzałka dla tego kto potrafi to wytłumaczyć winksmiley.jpg


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
seiya
post 26.11.2007, 23:14:10
Post #17





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 18.04.2007

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


blink.gif No jaja jak berety smile.gif
Go to the top of the page
+Quote Post
Daimos
post 30.11.2007, 13:00:47
Post #18





Grupa: Zarejestrowani
Postów: 1 319
Pomógł: 118
Dołączył: 26.11.2003
Skąd: Lublin

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


ostatnio mialem podobny problem, robiac kodowanie UTF-8
kwestia tego ze nie ktore edytory zle wstawiaja znaki o tym kodowaniu, cos szukalem w googlach, nie wiem czy dobrze zrozumialem, ale to powoduje wyslanie jakiegos cookies do przegladarki
proponuje zmienic edytor
bylem w szoku, ze to pomoglo
php expert editor
swietnie sobie radzi z UTF-8


--------------------
scriptun.com. Startup z poradnikami do gier ttp.zone i ttpzone.pl
Go to the top of the page
+Quote Post
Jarod
post 30.11.2007, 13:44:44
Post #19





Grupa: Zarejestrowani
Postów: 1 190
Pomógł: 27
Dołączył: 23.04.2005

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


Korzystam z eclipse no ale sprawdzę..


--------------------
”Godzina nauki w życiu nowoczesnego apostoła jest godziną modlitwy.”
(św. Josemaría Escrivá, Droga, 335)
Go to the top of the page
+Quote Post
miska
post 4.12.2007, 10:11:32
Post #20





Grupa: Zarejestrowani
Postów: 28
Pomógł: 0
Dołączył: 23.11.2003

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


  1. <link rel="stylesheet" href="Css/t51.css" type="text/css" />
  2. <link rel="stylesheet" href="Css/t52.css" type="text/css" />
  3. <link rel="stylesheet" href="Css/t53.css" type="text/css" />
  4. <link rel="stylesheet" href="Css/t54.css" type="text/css" />
  5.  
  6. <title>Tytuł</title>


Usuń odstęp między
  1. <link rel="stylesheet" href="Css/t54.css" type="text/css" />

a
  1. <title>Tytuł</title>


i jest OK

Nawet we wklejonym kodzie widać że masz spacje w tej pustej linijce
Go to the top of the page
+Quote Post

2 Stron V   1 2 >
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: 7.07.2025 - 04:45