¿Cómo detecto un cambio en la URL con php?

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.

preguntado el 27 de noviembre de 13 a las 06:11

$_SERVER["REQUEST_URI"]; -

Are you using any MVC framework? -

$_SERVER['QUERY_STRING']; -

@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. -

@Hanky웃Panky: Could you give me an example of how to use it based on my situation? Thanks. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.