重定向到最后一个路径 - PHP

<?php echo "<a href=\"".$sql_slct->f("link_url")."\" target=\"_blank\">".$sql_slct->f("link_title")."</a>"; ?>

the above code will produced an output like this:

http://localhost/msuptplportal/app/cedec/www.softboxkid.com

How can I redirect the user to the last path which is www.softboxkid.com everytime user click the hyperlink?

If by last path, you mean the URL where the user came from, you can use that:

<a href="<?=$_SERVER['HTTP_REFERER']?>">Back</a>

EDIT: What I think you want is to remove the whole ...localhost... thingy. That you can do like this:

<?php
    $url = $sql_slct->f("link_url");
    if (0 !== stripos($url, 'http://')) {
       $url = 'http://' . $url;
    }
    echo '<a href="'.$url.'" target="_blank">'.$sql_slct->f("link_title").'</a>';
?>

You can do it as:

<?php echo "<a href=\"".array_pop(explode("/", $sql_slct->f("link_url")))."\" target=\"_blank\">".$sql_slct->f("link_title")."</a>"; ?>

This will add only last path in the link. Hope that helps