<?php
//index.php
//入口文件配置操作 // change the following paths if necessary
$yii=dirname(__FILE__).'/framework/yii.php'; //加载yii框架
$config=dirname(__FILE__).'/protected/config/main.php'; //加载配置如数据库等设定 // remove the following line when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);//开启调试模式 require_once($yii);
Yii::createWebApplication($config)->run();
<?php
//main.php
//数据库配置等操作 // uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder'); // This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'测试站YII_1.1',
'language' => 'zh_cn', // preloading 'log' component 日志preloading组件
'preload'=>array('log'), // autoloading model and component classes 自动加载模型和组件类
'import'=>array(
'application.models.*',
'application.components.*',
), //默认控制器设定 Action到对应控制里面设定方法 例如: public $defaultAction = 'index';
'defaultController'=>'index', //自定义模块
'modules'=>array(
'admin',
), // application components 应用组件
'components'=>array( /* 'user'=>array(
// enable cookie-based authentication 启用cookie的身份验证
'allowAutoLogin'=>true,
),*/ // uncomment the following to use a MySQL database MySQL数据库设定
'db'=>array(
'connectionString' => 'mysql:host=127.0.0.1:3306;dbname=test',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'tablePrefix' => 'blog_',//个人感觉不好用,不用可删除(不像常规TP框架可简写!)
), 'errorHandler'=>array(
// use 'site/error' action to display errors 报错显示错误级别
'errorAction'=>'site/error',
),
//url管理
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false, // 隐藏index,
'caseSensitive' => false, // 大小写不敏感
'rules'=>array(
/* 'post/<id:\d+>/<title:.*?>'=>'post/view',
'posts/<tag:.*?>'=>'post/index',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',*/
),
),
//日志设定
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
), // application-level parameters that can be accessed 配置参数设定
// using Yii::app()->params['paramName']
'params'=>require(dirname(__FILE__).'/params.php'),
);
<?php
//AdminModule.php
//后台模块配置操作 class AdminModule extends CWebModule
{
// public $defaultController = 'index'; //设置默认控制器 public function init()
{
// this method is called when the module is being created 创建模块时调用此方法
// you may place code here to customize the module or the application // import the module-level models and components 导入模块级模型和组件
$this->setImport(array(
'admin.models.*',
'admin.components.*',
));
} public function beforeControllerAction($controller, $action)
{
if(parent::beforeControllerAction($controller, $action))
{
// this method is called before any module controller action is performed 执行任何模块控制器动作之前调用此方法
// you may place customized code here
return true;
}
else
return false;
}
}

php YII 1.0常用CURD写法请点击查看

Yii 1.1 常规框架部署和配置的更多相关文章

  1. laravel5.6 常规框架部署和配置文件说明

    示例demo文件位置: 入口默认index.php文件地址: 例如: /laravel5.6/public/index.php (1) 必须先初始化路由web.php文件地址: 例如: /larave ...

  2. ThinkPHP框架部署

    ThinkPHP框架部署 1.下载ThinkPHP框架 下载地址:http://www.thinkphp.cn/ ThinkPHP官方网站 下载ThinkPHP3.2.3完整版,下载后如下图所示: A ...

  3. asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程

    最近在学习张善友老师的NanoFabric 框架的时了解到Exceptionless : https://exceptionless.com/ !因此学习了一下这个开源框架!下面对Exceptionl ...

  4. Tomcat是什么:Tomcat与Java技、Tomcat与Web应用以及Tomcat基本框架及相关配置

    1.Tomcat是什么       Apache Tomcat是由Apache Software Foundation(ASF)开发的一个开源Java WEB应用服务器. 类似功能的还有:Jetty. ...

  5. (原创)OpenStack服务如何使用Keystone (二)---部署和配置Keystone中间件

    (一)Keystone端的操作 (二)如何在OpenStack服务上部署Keystone中间件 (三)详细配置keystonemiddleware 部署OpenStack时一般先安装Keystone服 ...

  6. Win10上部署Apollo配置中心

    基于Docker在Win10上部署Apollo配置中心 https://www.jianshu.com/p/a1215056ce75 http://nobodyiam.com/2016/07/09/i ...

  7. C#实现多级子目录Zip压缩解压实例 NET4.6下的UTC时间转换 [译]ASP.NET Core Web API 中使用Oracle数据库和Dapper看这篇就够了 asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 asp.net core异步进行新增操作并且需要判断某些字段是否重复的三种解决方案 .NET Core开发日志

    C#实现多级子目录Zip压缩解压实例 参考 https://blog.csdn.net/lki_suidongdong/article/details/20942977 重点: 实现多级子目录的压缩, ...

  8. 微信小程序框架部署:mpvue+typescript

    开发前提: 1.在微信公众平台注册申请 AppID 2.安装开发者工具https://developers.weixin.qq.com/miniprogram/dev/devtools/downloa ...

  9. 【转】asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程

    最近在学习张善友老师的NanoFabric 框架的时了解到Exceptionless : https://exceptionless.com/ !因此学习了一下这个开源框架!下面对Exceptionl ...

随机推荐

  1. 最长k可重线段集问题【费用流】【优先队列Dijkstra费用流】

    题目链接 与最长K可重区间问题一样的解法,但是这道题却有很多需要注意的地方,譬如就是精度问题,一开始没考虑到sprt()里面的乘会爆了精度,然后交上去竟然是TLE,然后找的原因方向也没对,最后TLE了 ...

  2. CDH平台搭建解决离线安装依赖包的方法

    背景介绍: 1CDH开发平台在搭建的过程中,会遇到各种各样的问题,其中的各种依赖就是一个很让人头痛的问题.如果安装脚本文件出现了这种问题,那么就可以把以下的这种方法加入shell中,但是不要用yum来 ...

  3. 《剑指offer》面试题12 打印1到最大的n位数 Java版

    书中方法:这道题的一个陷阱在于不能用int或者long去存储你要打印的数,然后用打印函数打印,因为这个数可能会很大.如果加1后超出了最大的n位数,就不打印了.用最高位是否进位判断是否结束,打印的时候注 ...

  4. Linux安装Python3以及虚拟环境

    python3的linux环境编译安装 1.linux下安装软件的方式 选则yum工具,方便,自行解决软件之间的依赖关系,自动下载且安装 1.配置yum源 可以选择阿里云源,清华源等 配置第一个仓库, ...

  5. HDU-1269 迷宫城堡(连通分量)

    迷宫城堡 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submi ...

  6. openstack stein部署手册 9. neutron

    # 安装程序包 yum -y install openstack-neutron-linuxbridge ebtables ipset # 变更配置文件 mv /etc/neutron/neutron ...

  7. 零点.Net Core 接触

    一.Program.cs类与Startup类 1.一切从Main开始,Main方法包含了是整个应用程序的入口 ASP.NET Core应用程序可以配置和启动主机(Host). 主机负责应用程序启动和生 ...

  8. nginx中break和last的区别

    一.环境准备 资源文件创建 mkdir -p /opt/tmp/wqy/test/aaa mkdir -p /opt/tmp/wqy/test/bbb echo "aaa" > ...

  9. nginx+flask+gevent+uwsgi实现websocket

    Websocket简介 WebSocket是HTML5开始提供的一种在单个 TCP 连接上进行全双工通讯的协议.在WebSocket API中,浏览器和服务器只需要做一个握手的动作,然后,浏览器和服务 ...

  10. Codeforces 1192B 全dfs序 + 线段树

    题意:给你一颗树,每次会修改一条边的边权,问修改之后的树的直径是多少? 思路:来源于:https://www.cnblogs.com/TinyWong/p/11260601.html 得到树的全序df ...