Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Przeładowanie tej samej strony = zapętlenie
IronStark
post
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 2
Dołączył: 18.04.2010

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


Witam, chciałem przeładować bieżącą stronę i w wyniku tej operacji przeglądarka wywala błąd, że strona zawiera pętle przekierowania

  1. <?php
  2. header("Location: ' . $_server['php_self']);
  3. ?>


(IMG:style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
tehaha
post
Post #2





Grupa: Zarejestrowani
Postów: 1 748
Pomógł: 388
Dołączył: 21.08.2009
Skąd: Gdynia

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


"The following example will first set a test cookie, then reload the page, and finally check whether cookies are enabled."

  1. <?php
  2. error_reporting (E_ALL ^ E_WARNING ^ E_NOTICE);
  3.  
  4. // Check if cookie has been set or not
  5. if ($_GET['set'] != 'yes') {
  6. // Set cookie
  7. setcookie ('test', 'test', time() + 60);
  8.  
  9. // Reload page
  10. header ("Location: checkcookies.php?set=yes");
  11. } else {
  12. // Check if cookie exists
  13. if (!empty($_COOKIE['test'])) {
  14. echo "Cookies are enabled on your browser";
  15. } else {
  16. echo "Cookies are <b>NOT</b> enabled on your browser";
  17. }
  18. }
  19. ?>

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: 14.10.2025 - 08:23