dt614037527 2017-04-07 14:00
浏览 35

是否可以使用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 2017-04-07 14:05
    关注

    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');
    }
    
    评论

报告相同问题?