yii安装简要笔记

1: 下载地址:http://www.yiiframework.com/

2:在Apache网站根目录建立ring文件夹(创建ring站点)

3:将解压的framework、requirements拷贝到ring目录下,在浏览器输入http://localhost:8088/ring/requirements/查看运行环境

4:打开cmd(以管理员权限运行)创建应用ring,切换到Apache根目录/framework/文件夹下,输入命令:yiic webapp Apache根目录/ring

    在浏览器输入http://localhost:8088/ring/,即可看到首页

5:打开ring/protected/config/main.php配置数据库链接信息(例如使用mysql,设置数据库名称、用户名、登录密码)

6:在mysql中创建数据库以及表,如

drop table if exists categories;

/*==============================================================*/
/* Table: categories                                            */
/*==============================================================*/
create table categories
(
   id                   int not null auto_increment comment '分类ID',
   category_id          int default 0 comment '父亲ID',
   displayorder         int default 0 comment '排序',
   name                 varchar(50) default '' comment '名称',
   icon                 varchar(80) default '' comment '图标(如: upload/123.png)',
   primary key (id)
);

alter table categories comment '分类表';

7:打开ring/protected/config/main.php配置GII工具,如下

'modules'=>array(
		// uncomment the following to enable the Gii tool
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'fuck',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
	),

8:配置表categories的CRUD,打开浏览器输入:http://localhost:8088/ring/index.php?r=gii      输入密码fuck,然后就可以CRUD了

    a: 点击[Model Generator],创建categories表的Model

       

        b:点击[Crud Generator],创建Category Model对应的Controller(Crud)、View

           

        c:访问测试: http://localhost:8088/ring/index.php?r=category

              格式:http://localhost:8088/ring/index.php?r=category/show&id=1

                          category :表示Controller,对应CategoryController

                          show:表示一个动作,对应CategoryController里面的showAction方法

                          id:表示传递给showAction的参数


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值