0

How to make virtual page In PHP like domain.com/"UserID"

like facebook is using facebook.com/"MyUserID" i'm sure That "MyUserID" page is not present on server how it is made?

4th Mar 2017, 10:40 PM
Arunbir Singh
Arunbir Singh - avatar
2 Antworten
+ 3
use an .htaccess file to send URL arguments as a string and then parse it with PHP via $_GET, then compare with the database
4th Mar 2017, 11:45 PM
Patrik Sokol
Patrik Sokol - avatar
0
Why don't you try something like: www.mysite.com/user?name="MyUserId" As you can see in your site folder there is another folder named "user", in which you must insert an index.php file, so when you write "www.mysite.com/user" you will be redirect on the index.php file but the link still to be easy to remember. In this php file you can use $_GET["name"] for get the user name, and than keep from a database the information that you need to fill the user page (as the photos, the number of friends, and so on) So, your database should contain these information for each user name, and than when you will search this name you can find the information that you will need ;) (I don't suggest you to use SQL for a big project, try something like a NoSQL database as mongodb ) I hope that you enjoy my answer, and sorry for my bad English, is not my language, I do my best!
4th Mar 2017, 11:41 PM
Popolizio Domenico