码迷,mamicode.com
首页 > 其他好文 > 详细

yii第二步

时间:2014-08-28 22:39:46      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   ar   for   div   cti   

yii第二步:

 

main.php

 

 

‘urlManager‘=>array(
‘urlFormat‘=>‘path‘,
‘rules‘=>array(
‘game/guess/<g:\w>‘=>‘game/guess‘,
‘gou/games/<g:\w>‘=>‘gou/game‘,
//index.php/gou/d(实际地址) => gou/index(真实隐射地址gou/index/g/d)
‘gou/<g:\w>‘=>‘gou/index‘,
),
),

 

实例:

GouController.php

class GouController extends CController
{
    public function actionIndex(){
        $this->render(‘index‘);
    }

    public function actionGame()
    {
        echo $this->createUrl(‘gou/games/x‘, array() );
        echo "<hr>";
        var_dump($_GET);
        $this->render(‘game‘);
    }
}

 

 

view/gou/index.php

<?php echo CHtml::link(‘aaaa‘, array(‘gou/games/a‘) ); ?><br>
<?php echo CHtml::link(‘bbbb‘, array(‘gou/games/b‘) ); ?><br>
<?php echo CHtml::link(‘cccc‘, array(‘gou/games/c‘) ); ?><br>
<a href="<?php echo $this->createUrl(‘gou/games/d‘, array() ); ?>">dddddd</a><br>
<a href="<?php echo $this->createUrl(‘gou/games/e‘, array() ); ?>">eeeee</a><br>

实际生成的HTML

<a href="/yii/demos/helloworld/index.php/gou/games/a">aaaa</a><br>
<a href="/yii/demos/helloworld/index.php/gou/games/b">bbbb</a><br>
<a href="/yii/demos/helloworld/index.php/gou/games/c">cccc</a><br>
<a href="/yii/demos/helloworld/index.php/gou/games/d">dddddd</a><br>
<a href="/yii/demos/helloworld/index.php/gou/games/e">eeeee</a><br>

 

yii第二步

标签:style   blog   color   os   io   ar   for   div   cti   

原文地址:http://www.cnblogs.com/achengmu/p/3943011.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!