CiiMS 开源项目使用教程
CiiMSCiiMS, A High Performance CMS Built in Yii项目地址:https://gitcode.com/gh_mirrors/ci/CiiMS
1. 项目的目录结构及介绍
CiiMS 项目的目录结构如下:
CiiMS/
├── assets/
├── commands/
├── config/
├── controllers/
├── extensions/
├── messages/
├── models/
├── runtime/
├── tests/
├── views/
├── web/
├── yii/
├── yii.bat
├── yii.php
├── composer.json
├── README.md
目录介绍:
assets/
: 存放项目资源文件。commands/
: 存放命令行脚本。config/
: 存放配置文件。controllers/
: 存放控制器文件。extensions/
: 存放扩展文件。messages/
: 存放多语言消息文件。models/
: 存放模型文件。runtime/
: 存放运行时生成的文件。tests/
: 存放测试文件。views/
: 存放视图文件。web/
: 存放Web入口文件。yii/
: 存放Yii框架文件。yii.bat
: Yii框架的批处理文件。yii.php
: Yii框架的入口文件。composer.json
: Composer配置文件。README.md
: 项目说明文档。
2. 项目的启动文件介绍
CiiMS 项目的启动文件是 yii.php
,它位于项目根目录下。这个文件是Yii框架的入口文件,负责初始化应用并启动应用。
<?php
// 引入Yii框架的入口文件
require(__DIR__ . '/yii/yii.php');
// 创建应用实例并运行
$config = require(__DIR__ . '/config/web.php');
(new yii\web\Application($config))->run();
3. 项目的配置文件介绍
CiiMS 项目的主要配置文件是 config/web.php
,它包含了Web应用的配置信息。
<?php
$params = require(__DIR__ . '/params.php');
$db = require(__DIR__ . '/db.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'your-secret-key',
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => $db,
],
'params' => $params,
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}
return $config;
配置文件介绍:
id
: 应用的唯一标识。basePath
: 应用的根目录。bootstrap
: 启动过程中需要加载的组件。components
: 应用的
CiiMSCiiMS, A High Performance CMS Built in Yii项目地址:https://gitcode.com/gh_mirrors/ci/CiiMS