我在Codeignite模型中有一个只返回一行的函数。这个波纹管代码是我在Codeigniter模型中的功能:
@IBDesignable
现在我想使用此函数在控制器函数中返回的字段值,如下所示:
@IBDesignable class AttributedNavigationBar: UINavigationBar {
@IBInspectable var imageTitle: UIImage? = nil {
didSet {
guard let imageTitle = imageTitle else {
topItem?.titleView = nil
return
}
let imageView = UIImageView(image: imageTitle)
imageView.frame = CGRect(x: 0, y: 0, width: 40, height: 30)
imageView.contentMode = .scaleAspectFit
topItem?.titleView = imageView
}
}
}
但是当我运行此代码时,会显示以下错误:
消息:未定义的索引:home_ads_quantity
我怎么解决? 请指导我。
答案 0 :(得分:0)
试试看:::
模型
public function Load_Home_Page_Theme(){
$CMD = "call load_home_page_theme()";
$query = $this->db->query($CMD);
return $query->row();
}
控制器:
public function Home(){
$this->load->model("Admin/Admin_getdata");
$HomePageTheme = $this->Admin_getdata->Load_Home_Page_Theme();
$data['HomePageTheme']=$HomePageTheme;
$this->load->view("User/Header", $data);
$data["AdsData"] = $this->Admin_getdata->Load_Ads_Data($HomePageTheme->home_ads_quantity);
$this->load->view("User/Home", $data);
$this->load->view("User/Footer");
}