【发布时间】:2016-04-12 19:42:02
【问题描述】:
我是 codeigniter 的新手,我想将参数作为查询字符串而不是段传递,我看过其他链接,但它们不起作用。我只想在这个特定的控制器上使用查询字符串。以下是我正在使用的代码:
<a href="<?=base_url()?>sample_qp/new_view/?id=<?=$a2?>">
<label class="fils-label">
Reload Page
</label>
</a>
在控制器中:
public function new_view($id)
{ $id=$this->input->get('id');
$data['name']=$id;
$this->load->view('load_new_sample_view',$data);
}
我已经设置了
$config['enable_query_strings'] = true;和 $config['uri_protocol'] = "PATH_INFO";但问题是我收到 404 page not found 错误。
【问题讨论】:
-
如果你没有使用过 Apache config 或 .htaccess 是不是忘记在 url 中添加 index.php?
-
@Arjun:我已经通过 .htaccess 从 url 中删除了 index.php
-
尝试连接值:
<?php echo base_url() . 'sample_qp/new_view/?id=' . $a2
标签: php codeigniter codeigniter-2