2012-02-10 8 views
0

私は、Webアプリケーション用に異なるモジュールを含むディレクトリ 'modules'を持っています。すべてのモジュールのすべてのindex.phpを 'modules'フォルダに含めるにはどうしたらいいですか? Wordpressのは、そのプラグインをロードする方法としてPHP - ディレクトリを読み込んですべてのindex.phpをインクルード

そこで、基本的に同じ。

これは、 'モジュール' フォルダの構造である:

[modules] 
     [some-module] 
      - index.php 
      - functions.php 
      - other.php 
     [another-module] 
      - index.php 
      - stuff.php 
     [someother] 
      - index.php 
      - script.js 

感謝!!

答えて

1

これを行いますか?

<?php 

$indexes = glob('modules/*/index.php'); 

foreach ($indexes as $path) { 
    require_once $path; 
} 
関連する問題