{"id":451,"date":"2016-10-14T07:51:34","date_gmt":"2016-10-14T06:51:34","guid":{"rendered":"http:\/\/www.yellowweb.id\/blog\/?p=451"},"modified":"2016-10-14T07:51:34","modified_gmt":"2016-10-14T06:51:34","slug":"solusi-cannot-modify-header-di-php","status":"publish","type":"post","link":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/","title":{"rendered":"Solusi Cannot Modify Header di PHP"},"content":{"rendered":"<p>Untuk artikel kali ini saya akan membahas masalah yang kerap ditemui bagi programmer php ketika melakukan pengalihan (redirect) halaman web. Terkadang kita akan menemukan notifikasi pada saat redirect halaman web, seperti berikut:<!--more--><\/p>\n<p><span style=\"color: #ff0000;\"><code><b>Warning<\/b>: Cannot modify header information - headers already sent by (output started at<\/code><\/span><\/p>\n<p>nah teman-teman bisa mencoba mengatasinya dengan trik sebagai berikut:<\/p>\n<p>Letakkan perintah <code><span style=\"color: #ff0000;\">ob_start();<\/span> <\/code>pada bagian paling atas kode.<\/p>\n<p>Letakkan perintah <code><span style=\"color: #ff0000;\">ob_flush();<\/span> <\/code>atau <span style=\"color: #ff0000;\"><code>ob_end_flush<\/code><\/span> pada bagian bawah kode.<\/p>\n<p>Untuk perintah lengkapnya seperti ini:<\/p>\n<pre class=\"lang:default decode:true \">&lt;?php\r\n  ob_start();\r\n?&gt;\r\n&lt;!doctype html&gt;\r\n  &lt;head&gt;\r\n     &lt;title&gt;&lt;\/title&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n\r\n  &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n&lt;?php\r\n  ob_end_flush();\r\n?&gt;<\/pre>\n<p>Dengan cara seperti diatas kemungkinan kita tidak akan menemukan notifikasi warning tadi ya.<\/p>\n<p>Semoga artikel ini bermanfaat bagi teman-teman yang sedang memulai belajar PHP dan sampai jumpa di artikel berikutnya.<\/p>\n<p>Ciao,.. \ud83d\ude42<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Untuk artikel kali ini saya akan membahas masalah yang kerap ditemui bagi programmer php ketika melakukan pengalihan (redirect) halaman web. Terkadang kita akan menemukan notifikasi pada saat redirect halaman web, seperti berikut:<\/p>\n","protected":false},"author":1,"featured_media":453,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110,17],"tags":[258,260,88,259],"class_list":["post-451","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-tips-n-trik","tag-error","tag-header","tag-php","tag-web-proramming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Solusi Cannot Modify Header di PHP - YELLOWWEB.ID<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Solusi Cannot Modify Header di PHP - YELLOWWEB.ID\" \/>\n<meta property=\"og:description\" content=\"Untuk artikel kali ini saya akan membahas masalah yang kerap ditemui bagi programmer php ketika melakukan pengalihan (redirect) halaman web. Terkadang kita akan menemukan notifikasi pada saat redirect halaman web, seperti berikut:\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/\" \/>\n<meta property=\"og:site_name\" content=\"YELLOWWEB.ID\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-14T06:51:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/www.yellowweb.id\/blog\/wp-content\/uploads\/2016\/10\/cannot-modify-headers-on-php.jpg?fit=750%2C350&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"yellowweb\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"yellowweb\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/\"},\"author\":{\"name\":\"yellowweb\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#\\\/schema\\\/person\\\/75188044e080844724e381ab6a5b9829\"},\"headline\":\"Solusi Cannot Modify Header di PHP\",\"datePublished\":\"2016-10-14T06:51:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/\"},\"wordCount\":98,\"image\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/10\\\/cannot-modify-headers-on-php.jpg\",\"keywords\":[\"error\",\"header\",\"php\",\"web proramming\"],\"articleSection\":[\"PHP\",\"Tips n Trik\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/\",\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/\",\"name\":\"Solusi Cannot Modify Header di PHP - YELLOWWEB.ID\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/10\\\/cannot-modify-headers-on-php.jpg\",\"datePublished\":\"2016-10-14T06:51:34+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#\\\/schema\\\/person\\\/75188044e080844724e381ab6a5b9829\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/10\\\/cannot-modify-headers-on-php.jpg\",\"contentUrl\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/10\\\/cannot-modify-headers-on-php.jpg\",\"width\":750,\"height\":350,\"caption\":\"cannot-modify-headers-on-php.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/solusi-cannot-modify-header-di-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Solusi Cannot Modify Header di PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/\",\"name\":\"YELLOWWEB.ID\",\"description\":\"Kursus Web Design | Kursus Web Programming | Mobile Web Apps | Digital Marketing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/#\\\/schema\\\/person\\\/75188044e080844724e381ab6a5b9829\",\"name\":\"yellowweb\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g\",\"caption\":\"yellowweb\"},\"sameAs\":[\"https:\\\/\\\/www.yellowweb.id\"],\"url\":\"https:\\\/\\\/www.yellowweb.id\\\/blog\\\/author\\\/yellowweb\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Solusi Cannot Modify Header di PHP - YELLOWWEB.ID","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/","og_locale":"en_GB","og_type":"article","og_title":"Solusi Cannot Modify Header di PHP - YELLOWWEB.ID","og_description":"Untuk artikel kali ini saya akan membahas masalah yang kerap ditemui bagi programmer php ketika melakukan pengalihan (redirect) halaman web. Terkadang kita akan menemukan notifikasi pada saat redirect halaman web, seperti berikut:","og_url":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/","og_site_name":"YELLOWWEB.ID","article_published_time":"2016-10-14T06:51:34+00:00","og_image":[{"width":750,"height":350,"url":"https:\/\/i0.wp.com\/www.yellowweb.id\/blog\/wp-content\/uploads\/2016\/10\/cannot-modify-headers-on-php.jpg?fit=750%2C350&ssl=1","type":"image\/jpeg"}],"author":"yellowweb","twitter_card":"summary_large_image","twitter_misc":{"Written by":"yellowweb","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#article","isPartOf":{"@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/"},"author":{"name":"yellowweb","@id":"https:\/\/www.yellowweb.id\/blog\/#\/schema\/person\/75188044e080844724e381ab6a5b9829"},"headline":"Solusi Cannot Modify Header di PHP","datePublished":"2016-10-14T06:51:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/"},"wordCount":98,"image":{"@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2016\/10\/cannot-modify-headers-on-php.jpg","keywords":["error","header","php","web proramming"],"articleSection":["PHP","Tips n Trik"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/","url":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/","name":"Solusi Cannot Modify Header di PHP - YELLOWWEB.ID","isPartOf":{"@id":"https:\/\/www.yellowweb.id\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#primaryimage"},"image":{"@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2016\/10\/cannot-modify-headers-on-php.jpg","datePublished":"2016-10-14T06:51:34+00:00","author":{"@id":"https:\/\/www.yellowweb.id\/blog\/#\/schema\/person\/75188044e080844724e381ab6a5b9829"},"breadcrumb":{"@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#primaryimage","url":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2016\/10\/cannot-modify-headers-on-php.jpg","contentUrl":"https:\/\/www.yellowweb.id\/blog\/wp-content\/uploads\/2016\/10\/cannot-modify-headers-on-php.jpg","width":750,"height":350,"caption":"cannot-modify-headers-on-php.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.yellowweb.id\/blog\/solusi-cannot-modify-header-di-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.yellowweb.id\/blog\/"},{"@type":"ListItem","position":2,"name":"Solusi Cannot Modify Header di PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.yellowweb.id\/blog\/#website","url":"https:\/\/www.yellowweb.id\/blog\/","name":"YELLOWWEB.ID","description":"Kursus Web Design | Kursus Web Programming | Mobile Web Apps | Digital Marketing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.yellowweb.id\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.yellowweb.id\/blog\/#\/schema\/person\/75188044e080844724e381ab6a5b9829","name":"yellowweb","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5afd1bfac26e9377e8f5e36afb624cf3690dd31cb07c3961dfbc736b9ff1912f?s=96&d=mm&r=g","caption":"yellowweb"},"sameAs":["https:\/\/www.yellowweb.id"],"url":"https:\/\/www.yellowweb.id\/blog\/author\/yellowweb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":1,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":452,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/posts\/451\/revisions\/452"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/media\/453"}],"wp:attachment":[{"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yellowweb.id\/blog\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}