• yii第二步


    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>
  • 相关阅读:
    POSIX 互斥锁: pthread_mutex_t
    cocos2dx 常见的32种切换场景的动画
    在Xcode中制作.a文件
    Xcode设置项之Architectures和Valid Architectures
    C/C++位操作运算符
    ValueVector和ValueMap
    iOS工程结构理解
    CocoaPods的安装
    Win7平台下配置Sublime Text2 的C++编译环境
    Objective-C中Block的常见用法
  • 原文地址:https://www.cnblogs.com/achengmu/p/3943011.html
Copyright © 2020-2023  润新知