/ Published in: PHP
Just a little link helper that I did for a friend.
Expand |
Embed | Plain Text
<?php /** * function site_url * * ex. site_url('path/to/file'); */ function site_url($path) { $base_url = "https://{$_SERVER['SERVER_NAME']}".URI; } else { $base_url = "http://{$_SERVER['SERVER_NAME']}".URI; } if($base_url[str_len($base_url) - 1] != '/') $base_url = $base_url.'/'; return $base_url.$path; } ?>
You need to login to post a comment.
