gpt4 book ai didi

php - 如何将值从 View 传递到 Controller

转载 作者:行者123 更新时间:2023-11-30 00:45:17 25 4
gpt4 key购买 nike

这是我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com