Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
梳理包括php文件_Php - Fatal编程技术网

梳理包括php文件

梳理包括php文件,php,Php,我有单独的php文件。我有一个主文件,我使用包括这些文件,如 /include '1.php'; /include '2.php'; / include '3.php'; 现在我想把这3个文件合并成一个php文件。我如何使用它们,因为在我的主代码中有3个条件,比如条件1使用文件1.php条件2使用文件2.php等等 thanx如果要将文件合并为一个文件,但仍使用主文件的条件,只需将包含文件中的代码包含在用于选择包含文件的相同条件中即可。如果你有: if(A){ i

我有单独的php文件。我有一个主文件,我使用包括这些文件,如

    /include '1.php';
    /include '2.php';
   / include '3.php';
现在我想把这3个文件合并成一个php文件。我如何使用它们,因为在我的主代码中有3个条件,比如条件1使用文件1.php条件2使用文件2.php等等
thanx

如果要将文件合并为一个文件,但仍使用主文件的条件,只需将包含文件中的代码包含在用于选择包含文件的相同条件中即可。如果你有:

if(A){
    include "1.php";
}
if(B){
    include "2.php";
}
if(C){
    include "3.php";
}
而是使用:

if(A){
    //contents of 1.php here
}
if(B){
    //contents of 2.php here
}
if(C){
    //contents of 3.php here
}

如果要将文件合并为一个文件,但仍使用主文件的条件,只需将包含文件中的代码包含在用于选择包含文件的相同条件中即可。如果你有:

if(A){
    include "1.php";
}
if(B){
    include "2.php";
}
if(C){
    include "3.php";
}
而是使用:

if(A){
    //contents of 1.php here
}
if(B){
    //contents of 2.php here
}
if(C){
    //contents of 3.php here
}

您好,您可以这样编写代码

<?php
    if(condition1) include('file1.php');           

    else if(condition2) include('file2.php');          

         else include('file3.php'); 
?>

你可以写这个

<?php
    if(condition1) include('file1.php');           

    if(condition2) include('file2.php');           

    if(condition3) include('file3.php');               

?>


干得好

您好,您可以这样编写代码

<?php
    if(condition1) include('file1.php');           

    else if(condition2) include('file2.php');          

         else include('file3.php'); 
?>

你可以写这个

<?php
    if(condition1) include('file1.php');           

    if(condition2) include('file2.php');           

    if(condition3) include('file3.php');               

?>


干得好

如果要生成一个文件,则文件1、2和3中的任何内容都需要前置到主文件的开头。如果要生成一个文件,则文件1、2和3中的任何内容都需要前置到主文件的开头。