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", ":");
    }
    ?>
    
  • 相关阅读:
    NodeJS简介
    SQL学习笔记(1)
    Linux常用命令03
    Linux常用命令02
    Linux常用命令01
    Java接口和抽象类的区别
    Optional解决空指针
    JVM的内存管理机制-转载
    mysql explain详解-转载
    rabbitmq消息处理-转载
  • 原文地址:https://www.cnblogs.com/workerman/p/5270919.html
Copyright © 2011-2022 走看看