Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] headers i cookies
zakaru
post
Post #1





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 5.10.2006

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


Witam,
mam taki oto problem:
Próbuje wysłać cookies za pomocą funkcji setcookie, ale oczywiście wyskoczyć musi błąd ;]
oto kod w php jaki napisałem:

  1. <?php
  2.  
  3.  
  4. if(!isset($_COOKIE['USTAWIENIA'])){
  5. $ustawienia="cos tam cos tam";
  6. setcookie("USTAWIENIA", $ustawienia, time()+120960000000, "/");
  7. $_COOKIE['USTAWIENIA']=$ustawienia;
  8. }
  9.  
  10. ?>


i teraz pojawia mi się taki oto błąd:

Kod
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /index.php:1) in /index.php on line 4

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /index.php:1) in /index.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at /index.php:1) in /index.php on line 9


z tego co zrozumiałem to php nie może wysłać cookies bo są już wysłane nagłówki... tylko najdziwniejsze jest to, że nic nie wysyłam przed cookies'em (no chyba, że się mylę), mógłby ktoś pomóc?

Ten post edytował zakaru 25.07.2008, 08:57:16
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Shili
post
Post #2





Grupa: Zarejestrowani
Postów: 1 085
Pomógł: 231
Dołączył: 12.05.2008

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


W jakim kodowaniu kodujesz ten skrypt? Jeśli to utf, to stawiam na znak BOM (Byte Order Mark). Zaopatrz się wtedy w edytor który to cudo potrafi usunąć (na przykład Notepad++)
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 5.10.2025 - 04:26