set_include_path 设置 include_path 配置选项

发表日期:2021-07-01 08:55:08 | 来源: | | 浏览(661) 分类:PHP 选项/信息 函数

set_include_path

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

set_include_path设置 include_path 配置选项

说明

set_include_path(string $new_include_path): string

为当前脚本设置 include_path 运行时的配置选项。

参数

new_include_path

include_path 新的值。

返回值

成功时返回旧的 include_path 或者在失败时返回 false

范例

示例 #1 set_include_path() 例子

<?php 
set_include_path('/usr/lib/pear');
// 或使用 ini_setini_set('include_path', '/usr/lib/pear');
?>

示例 #2 添加到include path

利用常量 PATH_SEPARATOR 可跨平台扩展 include path。

这个例子中我们把 /usr/lib/pear 添加到了 现有的 include_path 的尾部。

<?php 
$path = '/usr/lib/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>

参见

集速网 copyRight © 2015-2022 宁ICP备15000399号-1 宁公网安备 64010402001209号
与其临渊羡鱼,不如退而结网
欢迎转载、分享、引用、推荐、收藏。