zoukankan      html  css  js  c++  java
  • Php函数set_include_path()函数详解

    set_include_path——设置include_path配置选项。

    说明

    string set_include_path(string $new_include_path);
    为当前脚本设置include_path运行时的配置选项。

    参数

    new\_include\_path
        include\_path新的值。
    

    返回值

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

    范例

    Example 1

    <?php
    //自PHP4.3.0起可用
    set_include\_path('/usr/lib/pear');
    
    //在所有版本的PHP中均可用
    ini_set('include\_path','/usr/local/pear');
    ?>
    

    Examle 2
    利用常量PATH_SEPATATOR可跨平台扩展include_path。
    这个例子中我们把/usr/lib/pear添加到现有的include_path的尾部。

    <?php
    $path = '/usr/lib/pear';
    set\_include\_path(get\_include\_path() . PATH_SEPARATOR . $path);
    

    备注

    对于一些老版本的php,PATH\_SEPARATOR是没有定义的,可以使用下面的命令来定义。

    <?php
    if( ! defined("PATH_SEPARATOR")) {
        if(strpos($_ENV["OS"], "Win") != false)
            define("PATH_SEPARATOR", ";");
        else define("PATH_SEPARATOR", ":");
    }
    ?>
    
  • 相关阅读:
    css 样式表的书写顺序
    强大的动画插件。
    百叶窗特效(用move.js库)
    jq基础
    js动态控制表单表格
    js事件对象
    js事件
    js_DOM操作
    小明年龄、成绩、名次的求解问题
    如何获取亿图中的高质量图片?
  • 原文地址:https://www.cnblogs.com/workerman/p/5270919.html
Copyright © 2011-2022 走看看