如何使用php获得动态页面名称

I have a question, I developed an account dashboard that is accessible from a URL like http://example.com/dashboard. The question is: how can I dynamically change the page url, to do something like http://example.com/$username, so for example if an user register to my site, with the username "abcd", he will display /abcd instead of /dashboard.

you can use .htaccess to redirect all your request to index.php

RewriteEngine On
RewriteRule ^ index.php [L]

Then in your index.php, need to parse the URL ($_SERVER['REQUEST_URI']) and decide what to display depending on the URL parameter.