PHP包含的脚本执行就好像它在调用者脚本的目录中一样

I have a site which has a tree as follow:

public_html/
    index.php
    lang.fr.php
    lang.en.php
    lang.php
    description/
        index.php
        lang.fr.php
        lang.en.php
 ... (lots of directory basically like description)

All index.php include lang.php, which is supposed to include each pages' version of lang.fr.php or lang.en.php. However, if I simply put

include("lang.{$lang}.php");

it includes the lang.fr.php of the lang.php's directory.

Is it possible or do I have to put lang.php's content in each pages?

assign __DIR__ to a variable before the include, and use that variable to include the appropriate language file

I think the problem is that include() is simply doing what it is suppose to, which is include files from it's configured include_path.

You can actually update the include path in your PHP Configuration file, or better yet, update the include_path ONLY for the duration of the script, if that is your desire, using the set_include_path() function. The simplest solution would be simply typing the entire path in include().

Here is some documentation:

http://php.net/manual/en/function.set-include-path.php