iam使用codeigniter 2.2以下是我的控制器类
class Welcome extends CI_Controller {
public function index()
{
$test = "hello";
$this->load->view('welcome_message',$test);
}
}
以下是我的观点
<html><body><h1><?php echo $data?></h1></body></html>
尝试将变量传递给视图时不断收到此错误
遇到PHP错误严重性:通知消息:未定义的变量:data文件名:views / welcome_message.php行号:75
1 回答
试试这个,
在视野中
<html><body><h1><?php echo $test; ?></h1></body></html>
有关更多参考,请查看https://ellislab.com/codeigniter/user-guide/general/views.html