2016-09-07 11 views

回答

2

最好的辦法是爲了讓多爾康孵化器使用composer - 一組額外爾康 - 集成庫中也包含了鬍子的實現。

如何做到這一點:

  1. 在我們的項目中安裝作曲(或全球) curl -s http://getcomposer.org/installer | php
  2. 與以下內容創建composer.json: { "require": { "phalcon/incubator": "~3.0" } } 如果您在使用2.0.x的爾康使用而不是: { "require": { "phalcon/incubator": "~3.0" } }
  3. 運行作曲家安裝命令: php composer.phar install
  4. 添加作曲家自動加載器在您的項目中的某個地方使用例如: require_once APP_PATH . '/vendor/autoload.php'; 我通常將此行添加到config/loader.php,但它取決於您的項目結構。
  5. 設置鬍子爲您呈現的視圖組件

    //Setting up the view component 
    $di->set('view', function() { 
    
        $view = new \Phalcon\Mvc\View(); 
    
        $view->setViewsDir('../app/views/'); 
    
        $view->registerEngines(
         ['.mhtml' => 'Phalcon\Mvc\View\Engine\Mustache'] 
        ); 
    
        return $view; 
    }); 
    

就是這樣,你就大功告成了。

您可以通過Incubator github pageMustache implementation page瞭解更多信息。

相關問題