我使用一个变量来回应不同页面的不同标题,但我收到了一个错误

时间:2017-07-28 11:23:36

标签: php codeigniter codeigniter-2 codeigniter-3

[我在使用变量($ page_title)回显页面标题时遇到错误但它不起作用并显示错误] [这里是header.php文件的代码]

<head>
    <meta charset="UTF-8">
    <title><?php echo $page_title; ?></title>
    <meta name="description" content="sodalitesolutions">
    <meta name="author" content="sodalitesolutions">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/bootstrap/css/bootstrap.css'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/font-awesome/css/font-awesome.css'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/style/slider.css'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/style/mystyle.css'); ?>">
</head>

[Error :: function:_error_handler]

1 个答案:

答案 0 :(得分:2)

尝试添加:

$this->data['title'] = 'test';
$this->load->view('view_name',$this->data);