为什么我得到“无法修改由 registration_model 发送的头信息头"?codeigniter 中的错误? [英] Why I'm getting "cannot modify header information headers already sent by registration_model" error in codeigniter?
问题描述
我的 codeigniter 应用中的模型有问题.我收到发送标头信息的错误.基本上,codeigniter 抱怨我的注册模型先发送标头信息.这怎么可能?我认为模型仅用于保存 db 查询方法,仅此而已.有人可以解释一下吗?
I have a problem with model in my codeigniter app. I'm getting this error of sending headers information. Basically, codeigniter is complaining about my registration model sending header information before anything else. How is it possible? I thought that models are only for holding db queries methods and nothing more. Can someone please explain me that?
这是控制器开头的样子:
This is how the beginning of a controller looks like:
function User()
{
parent::Controller();
$this->view_data['base_url'] = base_url();
$this->load->model('User_registration_model'); // don't forget capital, it's important
$this->load->model('user_map_model'); // don't forget capital, it's important
$this->load->model('Tribe_model'); // don't forget capital, it's important
$this->load->library('email'); // Loading email library
$this->load->library('session'); // sets up the session
$this->load->library ('form_validation'); // Loading form validation library
$this->load->helper(array('form', 'url'));
}
推荐答案
请注意,标头应该在之前发送.确保在header函数之前没有code/html甚至空格/缩进,并且在第一个打开的php标签<?php
以及结束标签?>之前没有任何东西.
在您看来.
Note that headers should be sent before anything else. Make sure that there is no code/html or even space/indentation before the header function and there is nothing before the first opening php tag <?php
as well as ending tag ?>
in your view.
这篇关于为什么我得到“无法修改由 registration_model 发送的头信息头"?codeigniter 中的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!