Procesors Posted December 26, 2010 Report Share Posted December 26, 2010 Ka var apiet sadu problemu, ja browzeris pazino kludu: Notice: Undefined index: page in C:\wamp\www\index.php on line 33 <?php $page = $_GET['page']; if ($page) { $path = "inc/".$page.".php"; ... Ir problemas ar so: 'page' Bet es jau vinju defineeju ar $page Un video tutorialii shamais radija un viss bija OK. P.S. Atainojos, ka rakstu bez garumziimeem. Uz VM taadas nav uzstaaditas. Quote Link to comment Share on other sites More sharing options...
nikidijs Posted December 26, 2010 Report Share Posted December 26, 2010 $page==$_GET['page']; vai arī if (isset($_GET['page'])){ $path = "inc/".$page.".php"; ... a adrssbārā visp rāda to page ? Quote Link to comment Share on other sites More sharing options...
Procesors Posted December 26, 2010 Author Report Share Posted December 26, 2010 <?php if (isset($_GET['page'])) { $page=$_GET['page']; $path = "inc/".$page.".php"; ... Sitaa aizgaja. Paldies. Bet pirms tam lapas sakumaa bija tas errors un tad sekoja tas page saturs. It kaa funkcijas stradaja, bet kludas pazinjojums kaut kaa nesmuki tomeer. Quote Link to comment Share on other sites More sharing options...
daGrevis Posted December 26, 2010 Report Share Posted December 26, 2010 (edited) Short-hand's: $page = ( isSet( $_GET['page'] ) ? $_GET['page'] : NULL ); Edited December 26, 2010 by daGrevis Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 27, 2010 Report Share Posted December 27, 2010 It kaa funkcijas stradaja, bet kludas pazinjojums kaut kaa nesmuki tomeer. Principaa ieksh PHP ta nav kljuda, bet gan pieziime [ka labak taa nedariit].. Jo megjinaji veikt salidzinshanu ar neeksistejoshu mainiigo (tava konkreta gadijuma masiva$_GET elementu) .. labais programmeshanas stils nosaka ka jebkuram mainigajam buutu jbuut definetam ... Quote Link to comment Share on other sites More sharing options...
daGrevis Posted December 27, 2010 Report Share Posted December 27, 2010 Imho, ne tikai stils, bet, ja neesi definējis mainīgo, bet tas tiek izsaukts, tad ne tikai izlec paziņojums, ko var noslēpt, bet arī tas viss ierakstās Log'a failā. Un kāpēc piemēslot?! Bija kaut kur salīdzinājums par to, kas ir ātrāks: @, error_reporting(), isSet(), !empty(). Uzvarēja isSet() ar 10% pārsvaru. Cik atceros... =) 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.