1. get url infomation via php

  <?php
    $uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
    $uri_segments = explode('/', $uri_path);

    var_dump($uri_segments)
  ?>

2. get url information via jquery

  <script>
    var url = $(location).attr('href').split("/");
    var pname = url[url.length-1];
    console.log(url);
  </script>

0 Comments

Leave a Comment