Home > Backend Development > PHP Tutorial > 'href=' behind, '? 'What does it mean if there is nothing in front?

'href=' behind, '? 'What does it mean if there is nothing in front?

WBOY
Release: 2016-07-06 13:52:58
Original
1820 people have browsed it

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>
Copy after login
Copy after login

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 #?)

Reply content:

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>
Copy after login
Copy after login

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

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template