0

I am using codeigniter bonfire framework for creating a web. Everywhere where i m using echo json encode i am getting error in error logs like :-

ERROR - 2015-07-06 17:38:49 --> Severity: Warning  --> Cannot modify header information - headers already sent by (output started at... )

Why this error generate in error logs file. Its a example code where the warning generating.

public function get_filter()
    {
        if(!empty($_GET))
        {
            $search = $_GET;
            $restaurant = $this->discount_model->get_offer_restaurant_by_discount($_GET);
            echo json_encode($restaurant);
        }
        else{
            $restaurant = $this->discount_model->get_all_discount_restaurants();
            echo json_encode($restaurant);
        }
    }

Here the error generated at echo json_encode($restaurant) line. How to stopped this error.

1 Answer 1

1

There may be whitespace before the php open tag <?php in Your_Controller.php

Please remove whitespaces before <?php tags in all files.

Sign up to request clarification or add additional context in comments.

1 Comment

If white space, error would point on line 1. Check this answer though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.