まえがき phpで外部のページに飛ばしたい時とかに重宝する「header(“Location:○○”)」ですが、この前この関数を使用した時に「Warning: Cannot modify header information – headers already sent by ・・・」という見たことのないエラーが表示されました。 「header(“Location:○○”)」でエラーなんて出たことなかったので焦りましたが解決したので覚え書きです。 「Warning: Cannot modify header information・・・」エラーの原因 「Warning: Cannot modify header information・・・」エラーは考えられる原因が2つあります。 原因1「header()」関数の前に出力や改行 KoToRiはまさにこれが原因でした。 「header()」関
![「Warning: Cannot modify header information…」エラーの解決方法[PHP]](https://cdn-ak-scissors.b.st-hatena.com/image/square/253786324371084938062efc7aef2e7caa4388ce/height=288;version=1;width=512/https%3A%2F%2Fkotori-blog.com%2Fwordpress%2Fwp-content%2Fuploads%2Fphp.jpg)