标签: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>
标签:style blog color os io ar for div cti
原文地址:http://www.cnblogs.com/achengmu/p/3943011.html