¿Cómo detecto un cambio en la URL con php?
Frecuentes
Visto 93 veces
0
I have a textbox in which a user can input a name and it is stored as the following variable:
$name
After which, I have some php code that will create a string based on the contents of the input.
$site = "www.example.com/" . $username;
As an example, let's say the name John is stored, the $site variable would be:
$site = "www.example.com/John";
If I were to go to that URL via my browser, I get redirected to:
www.example.com/73281
Essentially, a string of numbers for that name, and this string is unique to each name. How should I go about getting that new URL, all with php? After that I would proceed to extract that string of numbers, but the only part I'm unsure about is how to actually get that new URL.
Gracias de antemano.
0 Respuestas
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php url variables or haz tu propia pregunta.
$_SERVER["REQUEST_URI"];
- Hanky PankyAre you using any MVC framework? - user2486495
$_SERVER['QUERY_STRING'];
- Hanky Panky@user2486495: I'm not too experienced with php, I am not too sure what that is and I would also prefer to keep it simple, but if there's absolutely no other option then I may have to use that. - user3030521
@Hanky웃Panky: Could you give me an example of how to use it based on my situation? Thanks. - user3030521