The main attraction of any social network is a user's profile; the user profile usually displays the basic information of a user and shows any content that they have created.
By the end of this section, our user profiles will work as follows:
If a visitor goes to
http://localhost/verge/user/johndoe
, our routing system will match it with the route/user/:username
The
index.php
file will takejohndoe
as the value forusername
, and pass it to theUser
class in an attempt to find the user document with a matching IDIf
johndoe
is found,index.php
will display a profile with the information forjohndoe
If
johndoe
is not found, the visitor will see a404
error, meaning that the user with that username does not exist