php - I can't get the page's number from the url -


i want current page's number url: localhost/mywebsite/prdc?page=2

if(isset($_get['page'])) {      $index = $_get['page'];      echo $index;   } 

and error: undefined index: page

and don't find id : print_r($_get);

the output :

array ( [controller] => prdc [action] => [id] => )

by using geturisegment() can specific uri segment or return segments available.

<?php  // if url http://www.timwickstrom.com/foo/bar/wow  echo geturisegment(1); //returns foo echo geturisegment(2); //returns bar  print_r(geturisegments()); //returns array(0=>'foo', 1=>'bar', 2=>'wow')  ?> 

if using framework codeigniter then,

$segment= $this->uri->segment(2); //2 returns bar 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -