这个标题有意义吗?:)
您能从包含的页面中确定PHP
您放入的<?php include 'SomeFile.php'; ?>
页面吗?
在要“ INCLUDED
”的页面中是否有基于抓取它的目的地的 if 语句?
我这样说对吗?
谢谢大家!
解决方案:
PAGEMAIN1.php
<?php
$MAIN2 ='';
$MAIN1 = 'MAIN1';
include 'PAGE1.php';
include 'PAGE2.php';
include 'PAGE3.php';
include 'PAGE4.php';
?>
PAGEMAIN2.php
<?php
$MAIN1 ='';
$MAIN2 = 'MAIN2';
include 'PAGE1.php';
include 'PAGE2.php';
include 'PAGE3.php';
include 'PAGE4.php';
?>
PAGE1.php
<?php
$PAGE1 = 'PAGE1';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 1 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 1 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGE2.php
<?php
$PAGE2 = 'PAGE2';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 2 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 2 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGE3.php
<?php
$PAGE3 = 'PAGE3';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 3 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 3 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGE4.php
<?php
$PAGE4 = 'PAGE4';
if($MAIN1 == 'MAIN1'){
echo '(This is PAGE 4 being "INCLUDED" in MAIN 1)<br>';
}
if($MAIN2 == 'MAIN2'){
echo '(This is PAGE 4 being "INCLUDED" in MAIN 2)<br>';
}
?>
PAGEMAIN1.php 的输出
(This is PAGE 1 being "INCLUDED" in MAIN 1)
(This is PAGE 2 being "INCLUDED" in MAIN 1)
(This is PAGE 3 being "INCLUDED" in MAIN 1)
(This is PAGE 4 being "INCLUDED" in MAIN 1)
PAGEMAIN2.php 的输出
(This is PAGE 1 being "INCLUDED" in MAIN 2)
(This is PAGE 2 being "INCLUDED" in MAIN 2)
(This is PAGE 3 being "INCLUDED" in MAIN 2)
(This is PAGE 4 being "INCLUDED" in MAIN 2)
以防万一你想知道。;) 谢谢!