PHP:我如何阅读URL的第二部分

How can I take out the part of the url after the view name Example:

The URL:

http://localhost/winner/container.php?fun=page&view=eims 

Extraction

eims 
<?php echo $_GET['view']; ?>  //eims

This is called a GET parameter. You can get it by using

<?php
    $view = $_GET['view'];

If this is for a URL which is not part of your website (e.g. Not your domain), but you wish to parse it. Something like this will work

$url = "http://example.com/index.php?foo=bar&acme=baz&view=asdf";
    $params = explode('?', $url)[1]; // This gets the text AFTER the ? Note: If using PHP 5.3 or less, this may not work. You would then need to split it into two lines with the [1] happening on $params.
    $pairs = explode('&', $params);

    foreach($pairs as $p => $pair) {
       list($keys[$p], $values[$p]) = explode('=', $pair);
          $splits[$keys[$p]] = $values[$p];
    }


echo $splits['view'];

If that's current URL, the simple and rock solid approach is to use the filter functions:

filter_input(INPUT_GET, 'view')

Otherwise, you can use parse_url() with PHP_URL_QUERY as second argument. The resulting string can be split with e.g. parse_str().

Are sure you are writing this "echo $_GET['view'];" in the container.php file?

Maybe write why do you need that "view".