Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [inne][PHP]Mod rewrite zmienna
goartur
post
Post #1





Grupa: Zarejestrowani
Postów: 233
Pomógł: 27
Dołączył: 19.10.2014

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


Witam, mam taki oto url:
/index.php?p=gallery

Jak moge zmienic wszystkie zmienne p na naprzyklad taki url:

/index.php/gallery
/index.php/login

Itp?
Go to the top of the page
+Quote Post
fate
post
Post #2





Grupa: Zarejestrowani
Postów: 824
Pomógł: 106
Dołączył: 14.03.2012
Skąd: Warszawa

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


Trop:
https://www.addedbytes.com/articles/for-beg...-for-beginners/
Go to the top of the page
+Quote Post
rad11
post
Post #3





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

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


Mozesz tez kombinowac cos w ta strone:

  1. $url = explode('/', $_SERVER['PHP_SELF']);
  2. $permission = array('gallery', 'login');
  3.  
  4.  
  5. if(!empty($url[3])){
  6. foreach($permission as $perm){
  7. if($perm == $url[3]){
  8. $_GET['p'] = $perm;
  9. include_once $perm . '.php';
  10. }
  11. }
  12. }

gallery.php
  1. var_dump($_GET['p']);


Jezeli wogole o taki efekt Ci chodzi.

Ten post edytował rad11 19.06.2015, 17:38:27
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: 13.10.2025 - 16:16