How to Fix Can not modify header information – headers already sent
Sometimes you get an error “Can not modify header information – headers already sent by (output started at C: \ wamp \ www \ gau_bong25 \ gio_hang \ them_sm.php: 39) in C: \ wamp \ www \ gau_bong25 \ gio_hang \ them_sm . php on line 40 “?
In php this is a very frequent mistake. There are two main causes of this error are:
+ Before you call the header function you echo a content something or a space.
+ Or is before the header function has command warning (ie the line of code before the header line fails)
Case 1: If before calling the function header, you do not use the echo command
In this case, error can be caused by previous commands have been warning. The fix here is that you add the @ character in front of the command line warning (to disable warning).
Case 2: If the header before calling the function, you have to use the echo command. You can refer to the following plan:
+ Option 1: Transfer the contents echo after function header content.
+ Option 2: Use the ob_start () and ob_flush ()
– Call ob_start () at the top of the file, the function ob_start () work boot of the server to store temporary buffer contents echo () on it.
– Call ob_flush function () at the end of the file, the function ob_flush () used to transfer data from the buffer back to the content server.
+ Option 3: If you have set the php.ini file server
Reset the output_buffering = ON in the php.ini file
In wordpress theme when you do, this error happens, and it happens often in the functions.php file.
When looking at the error line that we know what? the path you pay in parentheses (“them_sm.php: 39”), this error means be incurred in file them_sm.php and in line 39, go to this file and find the space, relegated outside php quotes “”. Within php okay, if whitespace, or word or anything as long as there is something in the html data in Export your movie.
wish you success.
Chào anh anh có thể giúp em với đc không ak?
em bị tự học thiết kế theme thi hiển thị lỗi.
Warning: Cannot modify header information – headers already sent by (output started at /home/creative/public_html/wp-content/themes/dl/functions.php:1) in /home/creative/public_html/wp-includes/pluggable.php on line 899
bạn vào file functions.php em để ý dòng số 1 xem có khoảng trắng nào không? ở ngoài vòng < ?php ?> em để ý xem có khoảng trắng không? nếu không có bạn để ý các đoạn code bên trong xem có xuất ra dòng chữ nào không
Thanks bạn ! Đang làm theo cách của bạn và đã sửa được !
mình rất vui khi các bài viết của mình có thể giúp ích cho ai đó, mình hiện tại đã nghỉ đi làm coder rồi. Công việc mệt mỏi quá với lại nghành này làm ở VN không khá nổi