用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2204|回复: 4
收起左侧

[已解决] 求教,我的redirect为什么报错

[复制链接]
发表于 2012-2-17 00:45:49 | 显示全部楼层 |阅读模式
代码如下,一个controller
PHP复制代码
 
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
        class Admin extends CI_Controller{
                function __construct(){
                        parent::__construct();
                        $this->load->database();
                        $this->load->helper('url');
                        $this->load->library('pagination');
                        date_default_timezone_set('Asia/Shanghai');
                }
               
                function index(){
                        redirect('login/');
                }
 
 
复制代码

我直接访问http://www.example.com/ci/admin
报错,信息为。
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at D:\AppServ\www\ci\application\controllers\admin.php:1)
Filename: helpers/url_helper.php
Line Number: 546
我想知道,我这些地方哪里有输出呢?

发表于 2012-2-17 10:54:52 | 显示全部楼层
错误提示,不能修改头消息-头消息已经被发送了。
发表于 2012-2-17 12:44:38 | 显示全部楼层
D:\AppServ\www\ci\application\controllers\admin.php 文件有 BOM,
什么是BOM请搜索论坛。
发表于 2012-2-17 13:45:47 | 显示全部楼层
BOM真是个讨厌的东西
 楼主| 发表于 2012-2-17 14:12:14 | 显示全部楼层
修改编码,成功了。谢谢各位

本版积分规则