实现后端yii

时间:2012-06-26 17:16:05

标签: php yii admin

我正在尝试从yii wiki实现目录结构 http://www.yiiframework.com/wiki/33/

我确信所有设置都正确但是当我尝试在后端/ config / main中使用urlManger时,我会收到此错误。

属性“CWebApplication.urlManager”是只读的

//后端/配置/ main.php

<?php
$backend=dirname(dirname(__FILE__));
$frontend=dirname($backend);
Yii::setPathOfAlias('backend', $backend);

return array(
    'basePath' => $frontend,

    'controllerPath' => $backend.'/controllers',
    'viewPath' => $backend.'/views',
    'runtimePath' => $backend.'/runtime',

    'import' => array(
        'backend.models.*',
        'backend.components.*',
        'application.models.*',
        'application.components.*',
    ),
    'urlManager'=>array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
        //'caseSensitive'=>false,
        'rules'=>array(
     //       'admin'=>array('adminUser', 'caseSensitive'=>false),
        )
    )
);

1 个答案:

答案 0 :(得分:3)

我认为urlManager是一个组件。尝试将它放在组件配置数组中:

return array(
    'basePath' => $frontend,

    'controllerPath' => $backend . '/controllers',
    'viewPath' => $backend . '/views',
    'runtimePath' => $backend . '/runtime',

    'import' => array(
        'backend.models.*',
        'backend.components.*',
        'application.models.*',
        'application.components.*',
    ),

    'components' => array(
        'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => false,
            //'caseSensitive'=>false,
            'rules' => array(
                // 'admin'=>array('adminUser', 'caseSensitive'=>false),
            )
        ),
    ),
);