我在我的viewregistration.php
文件中使用它
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?><?php echo $css; ?>reg_style.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?><?php echo $css; ?>style.css" />
</head>
<body>
<?php $this->load->view('include/header');?>
<?php $this->load->view('registration_view.php');?>
<?php $this->load->view('include/footer');?>
</body>
</html>
我在我的控制器中称它为
$data['title']= 'Registration';
$this->load->view("viewregistration.php", $data);
在我的控制器中,我正在使用
parent::__construct();
$this->load->helper('url');
$this->load->helper('form');
$this->load->database();
$this->load->model('user_model');
$this->load->model('systemdata');
$this->data['css'] = $this->systemdata->get_css_filespec();
$this->data['scripts'] = $this->systemdata->get_scripts_filespec();
$this->data['base_url'] = $this->systemdata->get_base_url();
但是css文件没有加载。它显示了一些错误,例如
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: base_url
和
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: css
我做错了什么?我使用了自动加载 url 助手。但结果还是一样。