codeigniter 页面标题未更改

问题描述 投票:0回答:1

我正在尝试更改 codeigniter 中的页面标题,但没能更改标题,似乎被困在旧名称中。

页面控制器php文件

 public function index() {
        $data['nurse'] = "Welcome to codigniter";
        $this->load->view('home/dashboard'); 
        $this->load->view('nurse', $data);
        $this->load->view('home/footer'); 
    }

页面查看php文件

<section id="main-content">
    <section class="wrapper site-min-height">
         <link href="common/extranal/css/nurse.css" rel="stylesheet">
        <section class="panel">
            <header class="panel-heading">
                Technicians
                <div class="col-md-4 no-print pull-right"> 
                    <a data-toggle="modal" href="#myModal">
                        <div class="btn-group pull-right">
                            <button id="" class="btn green btn-xs">
                                <i class="fa fa-plus-circle"></i>Add Technician
                            </button>
                        </div>
                    </a>
                </div>
            </header>
            <title><?php echo $page_title; ?> </title>
            <div class="panel-body">
                <div class="adv-table editable-table ">
                    <div class="space15"></div>
                    <table class="table table-striped table-hover table-bordered" id="editable-sample">
                        <thead>
                            <tr>
                                <th><?php echo lang('image'); ?></th>
                                <th><?php echo lang('name'); ?></th>
                                <th><?php echo lang('email'); ?></th>
                                <th><?php echo lang('address'); ?></th>
                                <th><?php echo lang('phone'); ?></th>
                                <th class="no-print"><?php echo lang('options'); ?></th>
                            </tr>
                        </thead>
                        <tbody>

我在视图文件中使用了这段代码

<title><?php echo $page_title; ?> </title>

还是没有变化,如何更改标题

php codeigniter
1个回答
0
投票

您声明 $data['nurse'] = "Welcome to codigniter";作为您的页面标题, 所以你应该打电话而不是 . 或者您可以声明变量 $data['page_title']="Welcome to codeigniter";而不是 $data['nurse']="欢迎来到 codeigniter";

© www.soinside.com 2019 - 2024. All rights reserved.