我的控制器页面是:
class Anasayfa extends CI_Controller {
public $viewData;
function __construct() {
parent::__construct();
$this->viewData = new stdClass();
$this->viewData->sayfa = 'main';
}
public function index()
{
$this->load->view('common/template', $this->viewData);
}
我的观看页面是:
$this->load->view('common/header'); $this->load->view('common/navbar'); $this->load->view('common/solmenu'); $this->load->view('common/slider'); $this->load->view($sayfa); $this->load->view('common/footer');
但是在浏览器中:
严重性:注意
消息:未定义的变量:sayfa
文件名:common / template.php
行号:6
答案 0 :(得分:2)
使用数组:
function __construct() {
parent::__construct();
$this->viewData = array();
$this->viewData['sayfa'] = 'main';
}
答案 1 :(得分:0)