d3yii2/yii2-app-basic

Yii 2 d3 项目模板

安装: 142

依赖者: 0

建议者: 0

安全: 0

星星: 0

观察者: 3

分支: 789

类型:package

2.0.6 2015-08-05 22:23 UTC

This package is auto-updated.

Last update: 2024-09-07 21:11:02 UTC


README

Yii 2 Basic Project Template 是一个适用于快速创建小型项目的 Yii 2 应用程序框架。

该模板包含基本功能,包括用户登录/注销和联系页面。它包含所有常用的配置,允许您专注于添加新功能。

Latest Stable Version Total Downloads Build Status

目录结构

  assets/             contains assets definition
  commands/           contains console commands (controllers)
  config/             contains application configurations
  controllers/        contains Web controller classes
  mail/               contains view files for e-mails
  models/             contains model classes
  runtime/            contains files generated during runtime
  tests/              contains various tests for the basic application
  vendor/             contains dependent 3rd-party packages
  views/              contains view files for the Web application
  web/                contains the entry script and Web resources

需求

本项目模板的最小需求是您的 Web 服务器支持 PHP 5.4.0。

安装

从存档文件安装

将从 yiiframework.com 下载的存档文件解压到 Web 根目录下名为 basic 的目录中。

config/web.php 文件中设置 cookie 验证密钥为某个随机字符串

'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '<secret random string goes here>',
],

您可以通过以下 URL 访问应用程序:

http://localhost/basic/web/

通过 Composer 安装

如果您没有 Composer,您可以按照 getcomposer.org 上的说明进行安装。

然后,您可以使用以下命令安装此项目模板

php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic

现在,假设 basic 是 Web 根目录下的目录,您应该可以通过以下 URL 访问应用程序。

http://localhost/basic/web/

配置

数据库

编辑 config/db.php 文件,使用实际数据,例如

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];

备注

  • Yii 不会为您创建数据库,您必须在访问之前手动完成。
  • 检查并编辑 config/ 目录中的其他文件,以根据需要自定义应用程序。
  • 有关基本应用程序测试的详细信息,请参阅 tests 目录中的 README。