简体   繁体   English

我如何在index.php上使用$ _GET

[英]how can I use $_GET on index.php

I have a filed called index.php within the same file I have a function that has links to call other pages as follows 我在同一文件中有一个名为index.php的文件,我有一个函数,该函数具有如下链接以调用其他页面

function pages() {
if(isset($_GET['page'])) {
       switch($_GET['page']) {
        case 'pageName':
             include('pageName.php');
             break;
        default:
             $err_page = include('err_pg.php');
             return $err_page;                             
             break;
    }
} else {
    $default = include('index.php');
    return $default;
}

} }

But When this function is executed on index.php it shows both pageName as called in index.php?page=pageName as well as index.php at the bottom of pageName. 但是,当在index.php上执行此函数时,它会同时显示在index.php?page = pageName中调用的pageName以及在pageName底部的index.php。 So how can I eliminate index.php to appear immediately after pageName once called? 那么,如何消除index.php在被调用的pageName之后立即出现?

die()而不是在包含文件后break

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM