【发布时间】:2013-12-11 08:12:10
【问题描述】:
我正在尝试在 symfony2 中渲染一个 php 文件。
在我正在使用的 config.yml 中:
# app/config/config.yml
framework:
# ...
templating: { engines: ['twig', 'php'] }
在控制器中:
public function installAction($name) {
$finder = new Finder();
$finder->files()->in('../src/Admin/ModuleBundle/Modules/'.$name.'/')->directories();
foreach ($finder as $file) {
return $this->render($file.'/install.php');
}}
但我得到了这个错误: 模板名称“../src/Admin/ModuleBundle/Modules/Module1/config/install.php”包含无效字符。
以及文件的内容:
< ?php echo "Module1 install";
我做错了什么? php 文件只是一个简单的回显
【问题讨论】: