1

new次のコードでは、ルートのタグとproduct/newルートのタグがあることがわかります。これらのタグが何に使用されているのかわかりません。それらを削除しても、html 出力に違いは見られません。popularproduct/index

$this->widget('zii.widgets.CMenu', array(
    'items'=>array(
        // Important: you need to specify url as 'controller/action',
        // not just as 'controller' even if default acion is used.
        array('label'=>'Home', 'url'=>array('site/index')),
        array('label'=>'Products', 'url'=>array('product/index'), 'items'=>array(
            array('label'=>'New Arrivals', 'url'=>array('product/new', 'tag'=>'new')),
            array('label'=>'Most Popular', 'url'=>array('product/index', 'tag'=>'popular')),
        )),
        array('label'=>'Login', 'url'=>array('site/login'), 'visible'=>Yii::app()->user->isGuest),
    ),
));
4

2 に答える 2

3

array('product/new', 'tag'=>'new')index.php?r=product/new&tag=new のような URL を作成します。これは、ProductController の actionNew で $_GET['tag'] = 'new'; を意味します。

于 2011-12-28T04:46:05.607 に答える
1

ちょっと待ってババ。私はそれらの参照を削除しません。コードが全体として実行される場合、どこかに新しいオブジェクトがあります!!

于 2011-12-28T04:48:01.437 に答える