A quick note for anyone using this function to add their own autoload extensions. I found that if I included a space in between the different extensions (i.e. '.php, .class.php') the function would not work. To get it to work I had to remove the spaces between the extensions (ie. '.php,.class.php'). This was tested in PHP 5.3.3 on Windows and I'm using spl_autoload_register() without adding any custom autoload functions.
Hope that helps somebody.
spl_autoload_extensions
(PHP 5 >= 5.1.2)
spl_autoload_extensions — spl_autoload 用のデフォルトの拡張子を登録し、それを返す
説明
string spl_autoload_extensions
([ string
$file_extensions
] )この関数は、__autoload() 用の代替関数である spl_autoload() が使用するファイル拡張子を変更したり調べたりします。
パラメータ
-
file_extensions -
引数なしでコールした場合は、現在の拡張子一覧をカンマ区切りで返します。 ファイル拡張子を変更するには、 新しい拡張子一覧をカンマ区切り文字列で表したものを引数に指定して、 この関数を実行します。
返り値
spl_autoload() のデフォルト拡張子の一覧をカンマ区切り形式で返します。
Jeremy Cook
03-Sep-2010 12:46
Kerry Kobashi
11-May-2010 11:50
Extensions include the period. For example:
spl_autoload_extensions(".inc, .php, .lib, .lib.php ");
