How to get server domain name on php
Think, there is a php script on http://example-domain.com/loging/register.php If you need get web site only domain on register.php file. You can use following php code for get server domain name on php
$serverPath='http://'.$_SERVER['SERVER_NAME'];
Note this is only for web site using http:// protocol
If your web site using https:// protocol use following php code
$serverPath='https://'.$_SERVER['SERVER_NAME'];
0 comments:
Post a Comment