Sunday, 15 September 2013

php - Is this way of using the method GET wrong? -


There is something I'm working on and I have a problem that I can only do this

<("?: Messages.php ID_Conversation = $ line [ID] location");> header pre

Is this "false"?

This is not correct right. As part of the URL, you are redirecting a resource and giving information to that resource as part of the URL, and it is completely acceptable.

However, this part is wrong as the URL is structured. If you are going to do this with any regularity, then you want to get involved in the habit of determining the position of the nearest status as possible.

At the very least it is to say that you must set the complete path related to the domain root:

  header ("Location: /any_directories/messages.php?id_Conversation= $ Row [ID] ");  

And at best, this means the domain and the protocol are also included:

  header ("location: https: //yourdomain.com/any_directories /messages.php?ID_Conversation=$row[ID] ");  

To make it easy, create an assistant function or object to control this type of redirect.

  Function Redirect ($ url) {Header ("Location: https://yourdomain.com/$url"); } Redirect ("any_directories / messages.php? Id_conversion = $ row [ID]");  

Obviously, the above mentioned function has other ideas, passing the data for GET query as an array, searching for the domain and / or protocol, and its use Should not be written in the form, but the idea is sound.


No comments:

Post a Comment