PHP包括除非在某个页面上,然后包含不同

I have a php site that includes a menu. There is a section that I do not want to include that menu, but want to include a different one. I am sure I need an if/else but am struggling.

my index is built like this
html and head
div wrapper
include header
include page build
include footer

the page build file uses the index template and calls for each pages content. therefore each page uses the same header and footer. i want to use a second header on a specific section.

so section 1, 3, 4, 5, 6, 7, 8 uses header 1
section 2 uses header 2

You could try using:

if ($_SERVER['SCRIPT_NAME'] == "/page1.php") {
    include("fileToInclude.php");
} else {
    include("differentFileToInclude.php");
}

say, you have a file called menu.php which you want to include in index.php and in that menu you do not want to include a menu/text called Loggin. Ok? Now, in menu.php you can do like this:

<p> Home </p><p> about</p><p> profile</p><p> blog</p><?php if(isset($allow)) {echo '<p> Loggin</p>';} else {echo "";}

With the above if/else you are telling PHP, if the variable $allow has any value echo Loggin, else show nothing. now all you have to do, is include your menu, but in index.php either set $value to anything if you want Loggin to be shown, or just leave it if you don't want loggin to not appear