创建目录testa 文件test1.php
创建目录testb 文件test3.php
创建文件test.php(与testa/testb同目录)
error_reporting(E_ALL);
ini_set("display_errors", 1);
//right
set_include_path("testa");
include 'test1.php';
include 'testb/test3.php';
test1();
test3();
//error
set_include_path("testa");
set_include_path("testb");
include 'test1.php';
include 'test3.php';
test1();
test3();
//error
ini_set("include_path", "testa");
ini_set("include_path", "testb");
include 'test1.php';
include 'test3.php';
test1();
test3();
//right
set_include_path(get_include_path().PATH_SEPARATOR."testa");
set_include_path(get_include_path().PATH_SEPARATOR."testb");
include 'test1.php';
include 'test3.php';
test1();
test3();
//right
ini_set("include_path", get_include_path().PATH_SEPARATOR."testa");
ini_set("include_path", get_include_path().PATH_SEPARATOR."testb");
include 'test1.php';
include 'test3.php';
test1();
test3();
博客展示了PHP中创建目录和文件的操作,重点围绕文件包含路径的设置进行了多种尝试。通过不同方式设置包含路径,如set_include_path和ini_set,测试对test1.php和test3.php文件的包含及函数调用,展示了正确和错误的设置示例。
7460

被折叠的 条评论
为什么被折叠?



