Kohana はKohana::find_file()
、外部ライブラリ コードをロードするために使用します。次に例を示します。
http://kohanaframework.org/3.2/guide/kohana/autoloading#include-zends-autoloader-in-your-bootstrap
通常、サードパーティ ライブラリを に配置しapplication/vendor
、コントローラー メソッド内で次のようにアクセスします。
// Load the library's feed.class.php file
require Kohana::find_file('vendor', 'rss-php/feed.class');
ただし、アプリケーション ルートより上のディレクトリからコードを読み込もうとしたことはありません。また、Kohana がクラス ファイルを見つけられるかどうかもわかりません。
Kohana::find_file()
次のように、でそれらをロードしようとすることができます。
// Load classes/autoload.php from two directories above application
require Kohana::find_file('../../classes', 'autoload');
DOCROOT
または、あなたのベースである に基づいて単に必要ですsub_app
:
require DOCROOT
. '..' . DIRECTORY_SEPARATOR
. 'classes' . DIRECTORY_SEPARATOR
. 'autoload.php';