2014-08-29 03:30 阅读 108


I have been trying to get the current directory link and come up with something like this as:

<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]paypal_success.php"; ?>

but really that didn't work as I got the output as :


so really I want to trim the invoice.php from it so if you can guide me please how I can do will be great..!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    droirqk4795 droirqk4795 2014-08-29 03:37

    Try to use dirname()

        echo "http://$_SERVER[HTTP_HOST]".dirname($_SERVER[REQUEST_URI])."/paypal_success.php";
    点赞 评论 复制链接分享
  • duan0065626385 duan0065626385 2014-08-29 04:13

    $path = test/invoice.phppaypal_success.php you should use basename($path), result is invoice.phppaypal_success.php

    or you can use basename($path,".html"), result is invoice.phppaypal_success

    $result_path = basename($path) then you can use substr() in php

    echo substr($result_path,5,-22);

    Maybe this can help you

    点赞 评论 复制链接分享