I use this code to get referer url:
<?php echo $_SERVER['HTTP_REFERER']; ?>
And the output is:
How should i do to get this?
I use this code to get referer url:
<?php echo $_SERVER['HTTP_REFERER']; ?>
And the output is:
How should i do to get this?
You could lop off everything after the ?
character.
$text = "http://example.com/application/view/viewleave.php?idleave=1";
$output = substr($text,0,strrpos($text,'?'));
echo $output;
edit: Like someone else said, if the string doesn't contain '?', then $output will be empty. So you could check for that first using strrpos()