daGrevis Posted March 19, 2009 Report Share Posted March 19, 2009 Problēma jau itkā nav problēma... :D function redirectToIndex() { header('Location: index.php'); } ...un tur, kur vajag, lai lapa pārdirektējās, likt, lai izpildās šī funkcija... Problēma! Ko darīt, ja izmetas šāds "error's"? Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\ProToType\styles\peace\overallHeader.php:4) in D:\xampp\htdocs\ProToType\includes\core.php on line 10 Quote Link to comment Share on other sites More sharing options...
bubu Posted March 19, 2009 Report Share Posted March 19, 2009 Prātīgāk ir strukturēt kodu tā, lai tu to zini jau lapas sākumā, pirms jebkāda izvada: <?php ... // apstrādājam $_GET/$_POST mainīgos un uzstādam $kautkas par True, ja vajadzēs redirektu if ($kautkas) { header("Location: ... "); die(); } ... // lapas html koda izvads ?> Quote Link to comment Share on other sites More sharing options...
Kaklz Posted March 19, 2009 Report Share Posted March 19, 2009 Viens no variantiem, kā to dabūt gatavu ir ieslēgt output buffering. Kas pārlūkam uzreiz nenosūta sākumā saģenerēto saturu. Bet nu pievienojos bubu - labāk piekopt tādu programmēšanas stilu, lai redirekti nebūtu kaut kur starp html izvadi. Quote Link to comment Share on other sites More sharing options...
cucumber Posted March 20, 2009 Report Share Posted March 20, 2009 ob_start(); // pirmaja rinda aiz <?php risinajums 4z, bet stradas uz goda ps. foruma 100% bija andrisp aprakstijis siki un smalki sho lietu, searchot ar kadreizs vajag Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 23, 2009 Author Report Share Posted March 23, 2009 Atvainojos ka nemeklēju... Paldies par risinājumu! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.