set_include_path
(PHP 4 >= 4.3.0, PHP 5, PHP 7)
set_include_path — include_path 設定オプションをセットする
説明
set_include_path
( string $new_include_path
) : string|false
include_path 設定オプションの値を、このスクリプト内でだけ変更します。
例
例1 set_include_path() の例
<?phpset_include_path('/usr/lib/pear');// または ini_set を使用しますini_set('include_path', '/usr/lib/pear');?>
例2 include path の追加
PATH_SEPARATOR
定数を利用することで、
オペレーティングシステムに依存せずに include path を追加することが可能です。
この例では、既存の include_path
の最後に
/usr/lib/pear
を追加します。
<?php$path = '/usr/lib/pear';set_include_path(get_include_path() . PATH_SEPARATOR . $path);?>
参考
- ini_set() - 設定オプションの値を設定する
- get_include_path() - 現在の include_path 設定オプションを取得する
- restore_include_path() - include_path 設定オプションの値を元に戻す
- include - include