Latest news
Home » PHP » function to remove trailing slashes from URL

function to remove trailing slashes from URL

php function to remove trailing slashes from URL

<?php
private function _curSiteURL() {
$pageURL = ‘http’;
if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;}
$pageURL .= “://”;
$pageURL .= $_SERVER[“SERVER_NAME”].dirname($_SERVER[‘SCRIPT_NAME’]).’/’;
if (substr($pageURL, -1) == ‘/’ ):
return substr($pageURL, 0, -1);
else:
return $pageURL;
endif;
}
?>

Leave a Reply

x

Check Also

How to print Codeigniter upload error

if you want to display errors on upload functionality in codeigniter. Use the following function ...