php-Yiistrap配置问题
作者:互联网
我正在尝试让Yiistrap(Yii框架的启动程序)在Cent OS 6.5上工作.我已经将yiistrap-master解压缩到extensions / bootstrap中,并将以下内容添加到protected / config / main.php中:
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// CWebApplication properties can be configured here.
return array(
'aliases'=>array(
'bootstrap'=>'/var/www/html/happytails/protected/extensions/bootstrap'
),
'import'=>array (
'bootstrap.helpers.TbHtml',
'components'=>array(
'bootstrap'=>array(
'class'=>'bootstrap.components.TbApi'
),
我还将注册功能添加到protected / views / layouts / main.php
<?php /* @var $this Controller */ ?>
<?php Yii::app()->bootstrap->register(); ?>
这应该可以,但是我一直遇到错误:
Alias “bootstrap.components.TbApi” is invalid. Make sure it points to an existing PHP file and the file is readable.
文件在那里并且可读.我不确定可能是什么问题.
[root@unknown000c29a635f6 extensions]# ls -l
total 4
drwxrwxrwx. 10 nobody nobody 4096 Feb 5 01:50 bootstrap
`[root@unknown000c29a635f6 bootstrap]# ls -l
total 112
drwxrwxrwx. 6 nobody nobody 4096 Feb 5 01:50 assets
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 behaviors
-rwxrwxrwx. 1 nobody nobody 296 Jan 29 14:40 codeception.yml
drwxrwxrwx. 2 nobody nobody 4096 Feb 6 20:29 components
-rwxrwxrwx. 1 nobody nobody 1075 Jan 29 14:40 composer.json
-rwxrwxrwx. 1 nobody nobody 54859 Jan 29 14:40 composer.lock
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 form
drwxrwxrwx. 3 nobody nobody 4096 Feb 5 01:50 gii
-rwxrwxrwx. 1 nobody nobody 555 Jan 29 14:40 Gruntfile.js
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 helpers
-rwxrwxrwx. 1 nobody nobody 1521 Jan 29 14:40 LICENSE.txt
-rwxrwxrwx. 1 nobody nobody 604 Jan 29 14:40 package.json
-rwxrwxrwx. 1 nobody nobody 370 Jan 29 14:40 README.md
drwxrwxrwx. 6 nobody nobody 4096 Feb 5 01:50 tests
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 widgets`
非常感谢您在此主题上可以提供的任何帮助.
解决方法:
我有同样的问题.您可以修复它,在main.php中配置所有必需的引导目录:
'import'=>array(
...
'bootstrap.helpers.*',
'bootstrap.widgets.*',
'bootstrap.behaviors.*',
),
标签:yii-extensions,php,twitter-bootstrap,yii 来源: https://codeday.me/bug/20191009/1878648.html