set_include_path

include_path 設定オプションをセットする

説明

stringfalse set_include_path(string $include_path)

include_path 設定オプションの値を、このスクリプト内でだけ変更します。

パラメータ

include_path

include_path の新しい値。

戻り値

成功した場合に元の include_path の値、失敗した場合に false を返します。

例1 set_include_path の例

<?php
set_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
  • restore_include_path
  • include