2016-07-02 7 views
0

私はzendスケルトンアプリケーションをインストールしました。複数のモジュールを追加するまでうまく動作します。問題は私が設定した仮想ホストにあります。シナリオは次のとおりです。複数のzendモジュールを持つ仮想ホスト

私は2つのサイト:cms.localhostsite.localhostを持っています。 これらの両方の仮想ホストは同じパブリックフォルダを指していますが、私はそれぞれのモジュールを使いたいと思っています。 cms.localhostCmsモジュールを使用し、site.localhostSiteモジュールを使用するよう指示するために使用できる仮想ホスト指令はありますか?

答えて

0

これを実現するには、おそらくhostnameルートタイプを使用できます。あなたはそれをhere in the documentationで読むことができます。

'router' => array(
    'routes' => array(
     'cms' => array(
      'type' => 'hostname', 
      'options' => array(
       'route' => 'cms.localhost', 
       'defaults' => array(
        '__NAMESPACE__' => 'Cms\Controller', 
        'controller' => 'Index', 
        'action' => 'index', 
       ) 
      ), 
      'may_terminate' => true, 
      'child_routes' => array(
       // your cms child routes 
      ) 
     ), 
     'site' => array(
      'type' => 'hostname', 
      'options' => array(
       'route' => 'site.localhost', 
       'defaults' => array(
        '__NAMESPACE__' => 'Site\Controller', 
        'controller' => 'Index', 
        'action' => 'index', 
       ) 
      ), 
      'may_terminate' => true, 
      'child_routes' => array(
       // your site child routes 
      ) 
     ) 
    ) 
), 

私はそれぞれのホスト名にデフォルトの名前空間を設定する'__NAMESPACE__'オプションを使用この例では:ここではあなたが始めるために、あなたの場合の例です。

+0

@CraigStandish私は自分の答えを更新しましたが、キー 'options 'を使って配列をラップするのを忘れていました... – Wilt

関連する問題