phalcon自动创建多模块项目的bug

来源:互联网 发布:react.js中文 编辑:程序博客网 时间:2024/06/05 19:27

原来的在自动创建的多模块项目中   app->config->services.php 最下面的代码

/** * Configure the Volt service for rendering .volt templates */$di->setShared('voltShared', function ($view) {    $config = $this->getConfig();    $volt = new VoltEngine($view, $this);    $volt->setOptions([        'compiledPath' => function($templatePath) use ($config) {            // Makes the view path into a portable fragment            $templateFrag = str_replace($config->application->appDir, '', $templatePath);            // Replace '/' with a safe '%%'            $templateFrag = str_replace('/', '_', $templateFrag);            return $config->application->cacheDir . 'volt/' . $templateFrag . '.php';        }    ]);    return $volt;});

里面的return  $templateFrag 带有路径 必须使用basename函数去掉 basename介绍

修改之后结果,多模块项目运行正常

/** * Configure the Volt service for rendering .volt templates */$di->setShared('voltShared', function ($view) {    $config = $this->getConfig();    $volt = new VoltEngine($view, $this);    $volt->setOptions([        'compiledPath' => function($templatePath) use ($config) {            // Makes the view path into a portable fragment            $templateFrag = str_replace($config->application->appDir, '', $templatePath);            // Replace '/' with a safe '%%'            $templateFrag = basename(str_replace('/', '_', $templateFrag));            return $config->application->cacheDir . 'volt/' . $templateFrag . '.php';        }    ]);    return $volt;});


原创粉丝点击