Jump to content
php.lv forumi

mainigais nav definets


Procesors

Recommended Posts

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.

Link to comment
Share on other sites

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 ...

Link to comment
Share on other sites

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... =)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...