Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> parse_url, Jak parse_url("...") wyświetlić całą ..
neo.priv
post
Post #1





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 27.02.2004

Ostrzeżenie: (10%)
X----


Witam, przy pomocy

  1. <?php
  2.  
  3. $adres = parse_url("...")
  4.  
  5. ?>


wyciągnołem sobie czesc adresu URL i go podmienilem

  1. <?php
  2.  
  3. $replace = str_replace("oo.com", "bbb.pl", $host);
  4.  
  5. ?>


teraz chciałbym wysłąc do przeglądarki informacje z nowym adresem, lecz nie zabardz wiem jak.

Robiąć tak:
  1. <?php
  2.  
  3. print( $replace );
  4.  
  5. ?>


a

ptezymuje komuniktat
  1. Array


  1. <?php
  2.  
  3. header("Location: $replace "); 
  4.  
  5. ?>


wyslyła mnie do strony z błędem - brak tej strony

Rozumie ze tablica jest pusta.

Przy pomoce jakiej funkci moge wyświetlić caly adres po podmianie funkcja str_replace?
Go to the top of the page
+Quote Post
czachor
post
Post #2





Grupa: Zarejestrowani
Postów: 897
Pomógł: 40
Dołączył: 16.12.2003
Skąd: Warszawa

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


Kod
print_r($replace);
Go to the top of the page
+Quote Post
neo.priv
post
Post #3





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 27.02.2004

Ostrzeżenie: (10%)
X----


  1. <?php
  2.  
  3. print_r($replace)
  4.  
  5. ?>


daje mi nastepujący komunikat

  1. Array ( [scheme] => http [host] => bbb.pl )


i nie da sie go inaczej wlorzyc do

  1. <?php
  2.  
  3. header("Location: $replace ");
  4.  
  5. ?>


(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) ?
Go to the top of the page
+Quote Post
hwao
post
Post #4


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




Sklej to w caly url i bedzie... (masz tablice, musisz posklejac to w url)

parse_url" title="Zobacz w manualu php" target="_manual()
Go to the top of the page
+Quote Post
neo.priv
post
Post #5





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 27.02.2004

Ostrzeżenie: (10%)
X----


  1. <?php
  2.  
  3. print($replace[scheme]."://".$replace[host].$replace[path]);
  4.  
  5. ?>


Działa.
Go to the top of the page
+Quote Post
czachor
post
Post #6





Grupa: Zarejestrowani
Postów: 897
Pomógł: 40
Dołączył: 16.12.2003
Skąd: Warszawa

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


Mały szczegół, ale w sumie istotny. Apostrofy (włącz sobie E_ALL):
  1. <?php
  2. print($replace['scheme']."://".$replace['host'].$replace['path']);
  3. ?>
Go to the top of the page
+Quote Post

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: 22.08.2025 - 12:51