这是我的 Controller 代码
$data['query']= $this->webpages->get_where_custom('parent_id',0);
// i will get $id from view
$data['query']=$this->webpages->get_where_custom('parent_id',$id);
$this->load->view-(template,$data);
在 View 代码中,我将发送 $id 到 Controller ,但它显示 undefined variable “id”
<?php
foreach($query->result() as $row){
$id=$row->id; // how to send this $id to my controller
$page_url=$row->page_url;
$parent_id=$row->parent_id;
$page_headline=$row->page_headline;
foreach($query->result() as $row){
$page_url=$row->page_url;
$page_headline=$row->page_headline;
?>
echo $page headline;
}
}
最佳答案
安装:
$this->load->view-(template,$data);
尝试:
$this->load->view(template,$data);
关于php - 如何将值从 View 传递到 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21428709/