我无法在视图页面中传递变量
这是我的控制器代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Management extends CI_Controller {
public function __construct()
{
parent::__construct();
if($this->session->userdata('level') != 1){
redirect('');
}
}
public function hotels()
{
$this->load->model('model_hotels');
$ss['most_view_hotels'] = '23';
$this->load->view("management/header_mng_view");
$this->load->view('management/hotels_mng_view' , $ss , true);
$this->load->view("management/footer_mng_view");
}
}
这是错误
遇到 PHP 错误
严重性:通知
消息:未定义变量:most_view_hotels
文件名:管理/hotels_mng_view.php
行号:22
hotels_mng_view.php
<?php
echo $most_view_hotels;
foreach($most_view_hotels as $value):
?>
<div class="row">
<div class="cell en">adsf</div>
<div class="cell en">1212</div>
<div class="cell en">12</div>
<div class="cell en">32</div>
</div>
<?php endforeach;?>