반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- codebuild
- VPN
- Flux
- chart.js
- node
- Airflow
- AWS CI/CD 구축하기
- Jenkins
- Spring Error
- COALESCE
- Python
- docker
- PostgreSQL
- Kafka
- codepipeline
- aws
- kubeflow
- redis
- codedeploy error
- chartjs
- JavaScript
- java bigdecimal
- Spring
- IntelliJ
- aws cicd
- SQL
- or some instances in your deployment group are experiencing problems.
- bootstrap
- codedeploy
- 도커
Archives
- Today
- Total
Small Asteroid Blog
[php] Message: Cannot modify header information - headers already sent by (output started at ) 에러 해결 본문
백엔드
[php] Message: Cannot modify header information - headers already sent by (output started at ) 에러 해결
작은소행성☄️ 2022. 7. 6. 15:55728x90
다음과 같은 에러가 생기는 윈인에 따라 해결 방법은 다르다.
방법1.
header('Content-Type: text/html; charset=utf-8'); 가 2번 실행시 발생하는 경우이다.
이 코드는 common.php 파일에 이미 포함되어 한번만 실행하면 되는 코드인데, 실수로 common.php 파일을 또 인클루드 해 2번 중복되어 실행 시 에러가 발생하는 것이다.
이러한 경우에는 common.php 파일에서 중복된 include 코드를 찾아서 제거해준다.
방법2.
setcookie() 함수를 사용할 때 발생하는 경우이다.
php 파일 상단에 아래의 코드를 추가해주면 된다.
<?php
ob_start();
setcookie, Cannot modify header information - headers already sent
I am new to PHP, I practised PHP setcookie() just now and failed. http://localhost/test/index.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head&g...
stackoverflow.com
728x90
반응형
'백엔드' 카테고리의 다른 글
[php] What does this mean in PHP: -> or => (0) | 2022.07.08 |
---|---|
[php] PHP Warning: Illegal string offset ' ' in (0) | 2022.07.07 |
[window] WSL2 Ubuntu 구동 시 Error: 0x800701bc WSL 2 (0) | 2022.04.28 |
메시지 브로커 / 이벤트 브로커 (0) | 2022.04.26 |
MSA 설계 시 참고 툴 (2) | 2022.04.21 |