dt614037527
dt614037527
2017-04-07 14:00

是否可以使用php截断URL

I am trying to find a solution to truncating the URL instead of showing - http://mywebsite.com/main/android.php?dir=.%2Fandroid it should show: http://mywebsite.com/main/android/android.php

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

1条回答

  • dongzhan7909 dongzhan7909 4年前

    Not sure whether you really want to that in PHP. What you can do is using the .htaccess file to provide such a url transformation.

    Otherwise you could do something like this:

    if (isset($_GET['dir'])) {
        $dir = $_GET['dir'];
        header('Location: ' . $dir . '/android.php');
    }
    
    点赞 评论 复制链接分享