Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Przekierowanie po x sekundach?
Mazur_pl
post 20.05.2007, 16:10:08
Post #1





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.05.2007

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


Siema, mam powiedzmy plik wyloguj.php:

  1. <?php
  2.  
  3.  
  4. echo("Wylogowales sie");
  5. ?>


I teraz chciałbym zrobić aby wyświetliło wylogowałeś sie a po 5 sekundach header("Location: index.php"); .
Go to the top of the page
+Quote Post
skowron-line
post 20.05.2007, 16:13:28
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


uzyj meta tagu


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
Mazur_pl
post 20.05.2007, 16:17:20
Post #3





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.05.2007

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


Myślałem o tym ale na przykład mam coś takiego:
  1. <?php
  2. if($t == yes) {
  3. echo('tekst');
  4. header po paru sekundach
  5. } else {
  6. cos
  7. header do innego pliku po paru sekundach
  8. }
  9. ?>
Go to the top of the page
+Quote Post
skowron-line
post 20.05.2007, 16:28:12
Post #4





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


sleep


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
Mazur_pl
post 20.05.2007, 16:30:06
Post #5





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.05.2007

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


@up
Też już to używałem ale wtedy dzieje mi się coś takiego:
mam sleep(3)
A zamiast wyświetlać echo(''); a potem header to robi to tak że przeglądarka ładuje się 3 sekundy a potem przekierowuje .
Go to the top of the page
+Quote Post
skowron-line
post 20.05.2007, 16:36:48
Post #6





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


a pokaz jak tego uzywales


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
Ludvik
post 20.05.2007, 16:37:26
Post #7





Grupa: Przyjaciele php.pl
Postów: 698
Pomógł: 3
Dołączył: 28.03.2004
Skąd: Wrocław

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


Nie zrobisz tego z poziomu PHP. Echo = nagłówki wysłane. Nie wyślesz ich po raz drugi. Jak otworzysz bufor, napiszesz co chciałeś, dasz sleep i wyślesz nagłówki, to użytkownik nie zobaczy tekstu, tylko będzie czekał 3 sekundy, żeby go przekierowało...

Ten post edytował Ludvik 20.05.2007, 16:37:48


--------------------
Go to the top of the page
+Quote Post
Mazur_pl
post 20.05.2007, 16:44:13
Post #8





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.05.2007

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


Ok, rozumiem. Dzięki.
@down
Dzięki

Ten post edytował Mazur_pl 20.05.2007, 17:40:49
Go to the top of the page
+Quote Post
siemakuba
post 20.05.2007, 17:12:44
Post #9





Grupa: Przyjaciele php.pl
Postów: 1 112
Pomógł: 20
Dołączył: 10.04.2005

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


  1. <?php
  2. echo 'Wyswietlam od razu';
  3. sleep(3);
  4. echo '<br>Wyswietlam po 3 sekundach';
  5. ?>


Trzeba tylko mieć na uwadze, co manual mówi na temat funkcji flush" title="Zobacz w manualu PHP" target="_manual:
Cytat
Several servers, especially on Win32, will still buffer the output from your script until it terminates before transmitting the results to the browser.


pozdr.
Go to the top of the page
+Quote Post

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: 15.08.2025 - 02:56