Yii返回exception.CHttpException.404错误

时间:2013-10-22 07:30:41

标签: php yii http-status-code-404 yii-components

我的Yii系统有些问题。所有模块在系统中都正常工作,但活动模块出错。它返回以下错误:

 2013/10/22 10:21:17 [error] [exception.CHttpException.404] exception 'CHttpException' with message '"activity/default/list" isteği çözümlenemedi.' in /var/www/yii/framework/web/CWebApplication.php:286
 Stack trace:
 #0 /var/www/yii/framework/web/CWebApplication.php(141):        CWebApplication->runController('activity/defaul...')
 #1 /var/www/yii/framework/base/CApplication.php(180): CWebApplication->processRequest()
 #2 /var/www/hello/index.php(13): CApplication->run()
 #3 {main}
 REQUEST_URI=/etkinlikler/liste

以下是活动模块的main和defaultController文件。

main.php

 <?php

 date_default_timezone_set('Asia/Istanbul');

return array(
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'name' => 'Kendim Panel',
'language' => 'tr',
'preload' => array('log'),
'import' => array(
    'application.models.*',
    'application.modules.*',
    'application.components.*',
    'application.helpers.*'
),
'modules' => array(  
    'gii' => array(
        'class' => 'system.gii.GiiModule',
        'password' => '121212',
        'ipFilters' => array('127.0.0.1, 192.168.1.27', '::1'),
    ),
    'wlapi' => array(),
    'panel' => array(),

    'ileti' => array(),
    'anket' => array(),
    'hastag' => array(),

    'category' => array(),
    'product' => array(),

    'menu' => array(),
    'siparis' => array(),

    'kisisel' => array(),
    'istatistik' => array()
),
'components' => array(
    'CString' => array('class'=>'CString'),
    'myFunc' => array('class'=>'myFunc'),
    'user' => array(
        'allowAutoLogin' => true,
    ),
    'db' => array(
        'connectionString' => 'mysql:host=localhost;dbname=kendim_db',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => 'root',
        'charset' => 'utf8',
    )
 ,       'urlManager' =>array(
        'urlFormat' => 'path',
        'showScriptName' => false,
        'rules' => array(
            '/' => 'panel/default', 
            'wl-api'                            => 'wlapi',
            'etkinlikler'                       => 'activity',
            'etkinlikler/ekle'                  => 'activity/default/create',
            'etkinlikler/duzenle'               => 'activity/default/update',
            'etkinlikler/duzenle/id/<id:\d+>'   => 'activity/default/update',
            'etkinlikler/sil'                   => 'activity/default/delete',
            'etkinlikler/sil/id/<id:\d+>'       => 'activity/default/delete',
            'etkinlikler/liste'                 => 'activity/default/list',
            'kategoriler'                       => 'category',
            'kategoriler/ekle'                  => 'category/default/create',
            'kategoriler/duzenle'               => 'cateogry/default/update',
            'kategoriler/duzenle/id/<id:\d+>'   => 'category/default/update',
            'kategoriler/sil'                   => 'category/default/delete',
            'kategoriler/sil/id/<id:\d+>'       => 'category/default/delete',
            'kategoriler/liste'                 => 'category/default/list',
            'urunler'                           => 'product',
            'urunler/ekle'                      => 'product/default/create',
            'urunler/duzenle'                   => 'product/default/update',
            'urunler/duzenle/id/<id:\d+>'       => 'product/default/update',
            'urunler/sil'                       => 'product/default/delete',
            'urunler/sil/id/<id:\d+>'           => 'product/default/delete',
            'urunler/liste'                     => 'product/default/list',
        ),
    ),
    'errorHandler' => array(
        'errorAction' => 'panel/default/error',
    ),
    'log' => array(
        'class' => 'CLogRouter',
        'routes' => array(
            array(
                'class'     => 'CFileLogRoute',
                'levels'    => 'error, warning',
            ),
        ),
    ),
    'image'=>array(
        'class'=>'application.extensions.image.CImageComponent',
        //GD or ImageMagick
        'driver'=>'GD',
        'params'=>array('directory'=>'/opt/local/bin',
            'product'=>array(
                    'size'=>array(
                        'detail'=>array(
                            'width' => 418,
                            'height' => 314
                        ),
                        'thumbnail'=>array(
                            'width' => 90, 
                            'height' => 68
                        ),
                        'org'=>array(
                            'width' => 800,
                            'height' => 600
                        ),
                    ),
            ),
        ),
    ),
),
 );
?>

DefaultController.php

 <?php 

 class DefaultController extends ActivityController
 {
public  $layout = 'activity';
private $actionStatus;
private $defaultDetailImageWidth;
private $defaultDetailImageHeight;
private $defaultListImageWidth;
private $defaultListImageHeight;
private $defaultOrgImageWidth;
private $defaultOrgImageHeight;

public function actionCreate() 
{

    $this->pageTitle = "Etkinlik Yönetimi > Etkinlik Ekleme";

    $this->render("create", array('model'=>$newActivityModel, 'actionStatus'=>$this->actionStatus, 'categoryGridList'=>$categoryGridList));
}

public function actionList()
{
    $this->pageTitle = "Etkinlik Yönetimi > Etkinlik Listeleme";

    $this->render("list");
}

public function actionDelete()
{
    $this->pageTitle = "Ürün Yönetimi > Ürün Silme";
    $this->render("delete", array('actionStatus' => $this->actionStatus));
}

public function actionUpdate()
{   
    $this->pageTitle = "Ürün Yönetimi > Ürün Güncelleme";
    $this->render("update", array('model'=>$product, 'actionStatus' => $this->actionStatus, 'categoryList' => $categoryList));
}

public function actionIndex() 
{   
    $this->render("index");
}

public function actionError() 
{   
    $this->render("error");
}
 }

 ?>

ActivityController.php

 <?php

 /**
 * Controller is the customized base controller class.
 * All controller classes for this application should extend from this base class.
 */

 class ActivityController extends CController {

/**
 * @var string the default layout for the controller view. Defaults to '//layouts/column1',
 * meaning using a single column layout. See 'protected/views/layouts/column1.php'.
 */

public $layout = '/layouts/column1';

/**
 * @var array context menu items. This property will be assigned to {@link CMenu::items}.
 */

public $constants = array();

public $menu = array(
        array('label'=>'Etkinlik Ekle', 'url'=>'/etkinlikler/ekle'),
        array('label'=>'Etkinlik Liste', 'url'=>'/etkinlikler/liste'),
    );

/**
 * @var array the breadcrumbs of the current page. The value of this property will
 * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
 * for more details on how to specify this property.
 */
public $breadcrumbs = array();
 }

我已将所有文件的权限设置为777,但仍然会收到相同的错误。 我还检查了系统无法进入控制器。我在main.php中收到错误 有什么问题?

2 个答案:

答案 0 :(得分:1)

好的,我发现了问题。我没有在main.php中定义活动模块。添加后      'activity'=&gt;阵列(); 问题解决了。

答案 1 :(得分:0)

更改

array('label'=>'Etkinlik Ekle', 'url'=>'/etkinlikler/ekle'),
array('label'=>'Etkinlik Liste', 'url'=>'/etkinlikler/liste'),

array('label' => 'Etkinlik Ekle', 'url' => array('activity/default/create')),
array('label' => 'Etkinlik Liste', 'url' => array('activity/default/list)),