如何从html网址获取页码[重复]

This question already has an answer here:

I'm trying to get page number from web address like beds.html?page=3

but, if I use php get method, then it's not returning anything.

I hope to find any easy solution.

cheers

</div>

If You Want that parameter on html page then you have to use javascript for it

<script>
    var param1var = getQueryVariable("page");

    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
      } 
      alert('Query Variable ' + variable + ' not found');
    }
    </script>

if you are on php page simply use

<?php 
 echo  $_GET['page']; 
?>

you can get page like this:

<?php 
$_REQUEST['page']; 
?>

and also you can type echo before $|_REQUEST to check you are getting proper page number or not

get is the right method to use.

<?php 
  $_GET['page']; 
?>