php set_include_path

博客展示了PHP中创建目录和文件的操作,重点围绕文件包含路径的设置进行了多种尝试。通过不同方式设置包含路径,如set_include_path和ini_set,测试对test1.php和test3.php文件的包含及函数调用,展示了正确和错误的设置示例。

创建目录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();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值