I can't get full url path

This question already has an answer here:

  • Get the full URL in PHP 28 answers

  • So you want to read out lang from the url params?

    if (!isset($_GET['lang']) || $_GET['lang'] == 'en')
        echo "ENGLISH";
    else
        echo "DE";
    

    If you just want to get the query string, to use in a link, use:

    echo $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'];
    

    Or to remove the ? when there is no query string:

    echo $_SERVER['PHP_SELF'] . ($_SERVER['QUERY_STRING']!=''?'?':'') . $_SERVER['QUERY_STRING'];
    
    链接地址: http://www.djcxy.com/p/42294.html

    上一篇: PhP脚本知道当前的URL

    下一篇: 我无法获得完整的网址路径