Home > Article > Backend Development > ‘href=’ behind, ‘? 'What does it mean if there is nothing in front?
This is on the pagination
<code><?php function pages($page,$e_page) { $html='<a href="?page=1">index</a>'.' '; $pre=($page-1<=0)?$page:($page-1); $html.='<a href="?page='.$pre.'">pre</a>'.' '; $next=($page+1>=$e_page)?$page:($page+1); $html.='<a href="?page='.$next.'">next</a>'.' '; $html.='<a href="?page='.$e_page.'">end</a>'.' '; return $html; } ?></code>
Please look at the fourth line. There is nothing before the question mark. Shouldn't there be an address code normally? Why is there nothing here?
(I think it means the current page, but isn’t the current page #?)
This is on the pagination
<code><?php function pages($page,$e_page) { $html='<a href="?page=1">index</a>'.' '; $pre=($page-1<=0)?$page:($page-1); $html.='<a href="?page='.$pre.'">pre</a>'.' '; $next=($page+1>=$e_page)?$page:($page+1); $html.='<a href="?page='.$next.'">next</a>'.' '; $html.='<a href="?page='.$e_page.'">end</a>'.' '; return $html; } ?></code>
Please look at the fourth line. There is nothing before the question mark. Shouldn't there be an address code normally? Why is there nothing here?
(I think it means the current page, but isn’t the current page #?)
The current page, but there are more page parameters
The "#" sign is actually the prefix of the anchor tag rather than the current page. The professional term is called web page hash. The browser's return button also uses this to locate web page content, and also supports JS to locate web pages
Click on the link specifying href="#content" to locate the hello world label. If there is only #, then locate it at the top. You will find that the webpage is not refreshed
But if the href is empty, it will navigate to the current page
If the current page address is
http://www.xxx.com/a.php?b=1&c=2
Then the page that <a href='?d=1'>???</a>
in this page jumps to is http://www.xxx.com/a.php?d=1