如果存在,则包含变量页面

I have multilanguage:

     switch ($lang) {
      case 'en':
      $lang_file = 'en.php';
      break;

      case 'lt':
      $lang_file = 'lt.php';
      break;

      case 'pl':
      $lang_file = 'pl.php';
  break;

  //case 'es':
 // $lang_file = 'lang.es.php';
  //break;

  default:
  $_SESSION['lang'] = "en";
  $lang_file = 'en.php';

}
include_once 'lang/'.$lang_file;
require('includes/config.php');

But I must enter all code to include language files manually

Is there a way to include it via variable?

I mean index.php?lang=de and system checks if there exist file de.php in lang folder. If its exist, then it uses as Case de or if it not exist, then use Default:?

I hope u understand the question.

You can use the file_exists() function.

Please note, that you should create a whitelist-array with all Language-Codes, for more security.

get variable name from url and check if file exists if not then include en.php. You must give root path to check file exists or not

$file = $_REQUEST["lang"];
$path = $_SERVER['DOCUMENT_ROOT'] ."/you_folder".$file."php";

if(file_exists($path){
include_once($file."php");
}
else{
include_once("en.php");
}

@George is correct but it is a security risk. I could spend the afternoon guessing file names and slowly map your whole website out.

Or imagine if the url was index.php?lang=../index. You would DOS yourself.

Some added security is to have a list of allowed language files.

$arrayAllowedLanguages = array('en', 'lt', 'pl');
if(in_array($lang, $arrayAllowedLanguages)){
    $lang_file = 'lang/' . $lang . '.php';
    if(file_exists( $lang_file )){
        include_once( $lang_file );
    }else{
        include_once( 'lang/en.php' );
    }
}

Update

Check out this wiki on RFI/LFI security risks. Wikipedia LFI/RFI