我正在使用_remap:
function _remap( $method )
{
// $method contains the second segment of your URI
switch( $method )
{
case 'hello':
$this->index();
break;
}
}
我想将网址更改http://localhost/blog
为http://localhost/blog/hello
我的 CI_Controller 是:
class Blog extends CI_Controller {
function __construct()
{
parent::__construct();
}
function _remap( $method )
{
// $method contains the second segment of your URI
switch( $method )
{
case 'hello':
$this->index();
break;
}
}
/**/
function index()
{
$g_subject = $this->input->get('id', TRUE);
$query = $this->db->get_where('miniblog', array('id' => $g_subject));
foreach ($query->result() as $row)
{
$data = array(
'subject' => $row->subject,
'title' => $row->title,
'image_path' => $row->image_path,
'alt' => $row->alt,
'text' => $row->text,
'date' => $row->date,
);
}
$this->load->view('miniblog/blog', $data);
//add customer size to databe on customer
//$this->customer_size_model->show();
}
function ipv6()
{
$this->load->view('miniblog/ipv6');
}
}
如何将其用于任何动态 id 并替换$row->subject
为 hello?