-5

错误:“注意:未定义的索引:第 8 行 C:\wamp\www\digi\admin\config\setup.php 中的页面”

我的代码是:

    <?php
   #setup document
                      //host-username-password-database_name
   $db = mysqli_connect('localhost','root','','dynamic');

   if($_GET['page'] == "")
               {$pg = 'home';}
   else
               {$pg = $_GET['page'];}

   include('/functions/sandbox.php');

   include('/functions/template.php');

   $page_title =  get_page_title($db,$pg);
?>
4

1 回答 1

4

$_GET['page']没有定义。要正确检查它是否存在,您应该使用isset()

 if(isset($_GET['page'])) {$pg = 'home';} else {$pg = $_GET['page'];}
于 2013-09-30T20:38:20.947 回答