Php 分页,不显示下一页
解决了强> 如果我点击第2页,那就是错误: 找不到 在此服务器上找不到请求的URL/rank/GetAll/30 我的链接是:Php 分页,不显示下一页,php,codeigniter,pagination,segment,Php,Codeigniter,Pagination,Segment,解决了 如果我点击第2页,那就是错误: 找不到 在此服务器上找不到请求的URL/rank/GetAll/30 我的链接是: http://localhost/rank/GetAll/30 模型:秩和模型 <?php Class Rank_Model extends CI_Model { public function __construct() { parent::__construct(); } public function record_count() {
http://localhost/rank/GetAll/30
模型:秩和模型
<?php
Class Rank_Model extends CI_Model {
public function __construct() {
parent::__construct();
}
public function record_count() {
return $this->db->count_all("ranking");
}
public function fifa_rank($limit, $start) {
$this->db->limit($limit, $start);
$query = $this->db->get("ranking");
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
}
?>
但接下来:
http://localhost/rank/GetAll/30
在secend link中,我没有index.php。我怎样才能修好它
在$config[“base_url”]=base_url()中。“排名/得分”;
我补充说:
$config[“基本url”]=基本url()。“index.php/rank/GetAll”
没关系:)看这里$data[“links”]=$this->pagination->create_links()代码>
正如代码所说,您有一个链接数组
foreach( $data["links"] as $links)
{?>
<p><?php echo $links; ?></p>
<?php }
foreach($data[“links”]作为$links)
{?>
尝试将默认值定义为$page=0以获取所有()并删除对$page=($this->uri->segment(3))?$this->uri->segment(3)的赋值:0;并在url中提供/after GetAll第一页的url是什么样子的?您的重写规则是否有效,这样您就可以使用url而不必index.php
?现在我知道我的问题出在哪里了。在第一页我有链接:但在下一页:在secend link中,我没有index.php。我如何修复它?尝试使用而不是base_url
在控制器中的方法GetAll
中。@marcin_poland-如果您已经解决了自己的问题,最好写一个新的答案,详细说明您的解决方案。不要忘记对任何有用的答案进行投票!
<table>
<thead>
<tr>
<td>Pozycja</td>
<td>Kraj</td>
<td>Punkty</td>
<td>Zmiana</td>
</tr>
</thead>
<?php
foreach($results as $data) {?>
<tbody>
<tr>
<td><?php print $data->pozycja;?></td>
<td><?php print $data->kraj;?></td>
<td><?php print $data->punkty;?></td>
<td><?php print $data->zmiana;?></td>
</tr>
<?php } ?>
</tbody>
</table>
<p><?php echo $links; ?></p>
http://localhost/index.php/rank/GetAll
http://localhost/rank/GetAll/30
foreach( $data["links"] as $links)
{?>
<p><?php echo $links; ?></p>
<?php }