Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用分页在索引页面上调用不同的html页面?_Php_Html_Pagination_Include - Fatal编程技术网

Php 使用分页在索引页面上调用不同的html页面?

Php 使用分页在索引页面上调用不同的html页面?,php,html,pagination,include,Php,Html,Pagination,Include,我会尽量说得具体一些。我有一个有很多图片的网站,在我的index.php文件中,我基本上称为一个包含所有这些图片的文件,如下所示: <?php include("content.html");?> 在content.html中,如下所示: <p2 id="152"> <em> #152 - 06 Feb, 2014 </em> </p2> <IMG class="displayed" src="images/scre

我会尽量说得具体一些。我有一个有很多图片的网站,在我的index.php文件中,我基本上称为一个包含所有这些图片的文件,如下所示:
<?php include("content.html");?>    

在content.html中,如下所示:

<p2 id="152"> <em> #152 - 06 Feb, 2014 </em> </p2>
<IMG class="displayed" src="images/screencaps/152.png" border="2"> <br /><br />  
#152-06 2014年2月


上百张图片

我想在这里做的是,使用(我相信这个词是)分页将这些内容分成不同的页面,因此在页面底部有一些类似于:

上一篇12 3[4]5 6下一篇

我希望将所有这些加载到index.php文件中,而不是实际更改页面以加载不同的图像集。 有没有一种方法可以将content.html拆分成各种不同的文件(content1.html用于图像1-20,content2.html用于图像21-40等),并使index.php更改用户单击底部哪个页面显示的内容

如果我所要求的不能实现,有没有其他方法来实现我想要的?
提前谢谢。

最好的方法是使content.html动态->content.php,然后使用php控制应该显示什么,不应该显示什么。如果您想坚持自己的方式,请拆分为content1.html content2.html等。。。这不是最好的方法,但您可以这样做:

   $file_to_include='content'.$page.'.html';
   include($file_to_include);

如果你想让我们给你一个有价值的答案,请先告诉我们你尝试过什么。你是否将图像资源保存到数据库中了不,我被告知数据库是实现这一目标的一个不错的方法,但老实说,我真的不太擅长数据库,所以我对这个想法感到气馁。我不完全确定我是否理解。我应该将内容文件设为.php文件吗?好吧但是,我不需要制作单独的php文件(content1.php、content2.php等),我只需要调用文件的哪些部分与分页按钮相对应?确切地说,您只需要1 content.php,其中包含显示内容的逻辑。好的,非常感谢!你能告诉我一些我可以通过谷歌来练习的关键词吗?(根据不同的页面按钮调用.php文件的不同部分)您可以使用if语句或switch($page)。。。我认为最好的方法是将日期和图像源存储在数据库中,然后从数据库中获取您想要的内容并显示出来,但如果您不习惯这些内容,这将需要您进行大量研究。是的,我对php不太熟悉,我对它相当陌生,并尝试自学,但您所说的是有意义的。我假设在php文件中,您将为每个20个图像分配一个页码id,因此$page1、$page2等等,尽管我可能会在几英里之外。