我按照http://www.cniska.net/yii-bootstrap/setup.html但是config/main.php中设置的路径别名对我不起作用:
<?php
// path alias for bootstrap
Yii::setPathOfAlias('bootstrap',Yii::getPathOfAlias(dirname(__FILE__).'/../extensions/bootstrap'));
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
...
受保护/扩展/引导/。。。是我的引导目录。
如果我想在布局/main.php 中使用它
Yii::app()->bootstrap->register();
上面写着"Alias"bootstrap.components.bootstrap"无效。请确保它指向现有的目录或文件。"
我尝试了很多东西,但都没能奏效。有什么想法吗?
您是否尝试在配置文件上自动加载引导程序?将"引导程序"添加到预加载数组中。这是我的:
'preload'=>array('log', 'bootstrap'),
我在生产服务器上遇到了这种情况,尽管它在本地运行良好。
解决方案是将apache所有权授予yii安装:
sudo chown www数据:www数据-R/var/www/yourapp
以前的所有权是root,apache看不到文件
在我的案例中,我刚刚将protected/extensions/bootstrap/components/Bootstrap.php
重命名为protected/extensions/bootstrap/components/bootstrap.php
一切都很好。