基本上,我有一个页面,您搜索一个术语,并查询数据库,这些术语是吐出的,包含查询和分页,如下所示:
1 2 [3] 4 5
MATTHEW 1:18
Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost.
MATTHEW 1:21
And she shall bring forth a son, and thou shalt call his name JESUS: for he shall save his people from their sins.
MATTHEW 1:25
And knew her not till she had brought forth her firstborn son: and he called his name JESUS.
我已经完成了,下面我没有:
当我点击“马修”时,它应该在新页面中列出“马修”中的所有经文和章节,分页。
当我单击返回(在浏览器中)时,它应该返回到上一个分页结果集(上面),当我单击向前(在浏览器中)时,它应该显示所有经文的页面和来自我点击的圣经部分(马修)。
我完全不知道如何开始这一切。
答案 0 :(得分:1)
您所描述的是当您提出RESTful请求时浏览器的正常行为。这只是意味着您包含在请求本身中显示正确页面所需的所有信息。由于您正在谈论简单链接,这意味着您在URL本身中传递了所需的信息:
http://example.com/verses.php?query=knew+her+not&page=3
http://example.com/verses.php?book=matthew
在verses.php
脚本中,检查是否存在$_GET['query']
和/或$_GET['book']
和$_GET['page']
,并根据这些变量动态检索和输出信息。然后,您只需要生成适当的链接,并且浏览器会处理后退/前进行为。