澳门新萄京官方网站-www.8455.com-澳门新萄京赌场网址

安装配置

2019-10-30 作者:www.8455.com   |   浏览(109)

转载自:

1.下载地址: Yii2 的高端级应用程序模板

  1. 前提条件,php版本得> 5.4

图片 1

D:phpStudy>php -v PHP 5.5.17 (cli) (built: Sep 16 2014 16:17:50) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies D:phpStudy>

2.布局与安装在服务器www目录下yii2test [下载下来改革advance为yii2test就能够]安排虚构主机 图片 2 安装成功后,查看前台 后台 安装成功了。3.安排连接数据库 在common/config/main-local.php  

2. 安装格局,豆蔻梢头种是直接下载压缩包,推荐使用composer方式安装,现在的势头。安装直接保管php已经帮助openssl (php.ini)查找Openssl
2.1 下载安装composer , 小编的景况是windows的 。

1   'db' => [2     'class' => 'yiidbConnection',3     'dsn' => 'mysql:host=localhost;dbname=yii2test',4     'username' => 'root',5     'password' => 'root',6     'charset' => 'utf8',7     'tablePrefix'=>'yii2_',8 ],

  使用migrate,生成数据库。图片 34.安装 AdminLTE 渲染后台   使用cmd在yii2test目录下

附:linux安装格局

1 composer require dmstr/yii2-adminlte-asset "2.*"

[root@mty01 2016-06-03]# curl -sS | php Downloading 1.1.2... Composer successfully installed to: /home/haozi/2016-06-03/composer.phar Use it: php composer.phar Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended. Composer works with 5.3.2 for most people, but there might be edge case issues. The OpenSSL library (1.0.0-fips) used by PHP does not support TLSv1.2 or TLSv1.1. If possible you should upgrade OpenSSL to version 1.0.1 or above. [root@mty01 2016-06-03]# ls composer.phar [root@mty01 2016-06-03]# du -sh composer.phar 1.6M composer.phar

  图片 4

  1. 安装配置。做到composer安装之后,须要设置composer的插件

1.复制D:phpStudyWWWyii2testvendordmstryii2-adminlte-assetexample-viewsyiisoftyii2-app 下的 layouts和site 到 D:phpStudyWWWyii2testbackendviews 中,覆盖重叠原本的公文。注意,在覆盖以前,请备份一下本来的文件

D:phpStudyWWWyii2>php composer.phar global require "fxp/composer-asset-plugin:~1.1.1" Changed current directory to C:/Users/liuhao14/AppData/Roaming/Composer ./composer.json has been created Loading composer repositories with package information Updating dependencies (including require-dev) - Installing fxp/composer-asset-plugin (v1.1.4) Downloading: 100% Writing lock file Generating autoload files D:phpStudyWWWyii2>

访问:

  1. 千帆竞发设置以前,须要配置多个github的token,这里不做汇报。意思是索要报名一个github的账号,然后生成二个token。
     参照如下路线,设置(注意上面xxxx显著是打码了,所以你直接利用用持续)

图片 5

C:Usersliuhao14AppDataRoamingComposer>dir /b .htaccess auth.json composer.json composer.lock composer.phar vendor C:Usersliuhao14AppDataRoamingComposer>type auth.json { "github-oauth": { "github.com": "xxxxxxxxxxx6fc824ea5a76ebc5fcdxxxxxxxxxx" } } C:Usersliuhao14AppDataRoamingComposer>

2.url 美化

5.重视,最初设置。由于国内情状的难题,安装时间比较长,半时辰也普及,只要程序没死,不要切断.....

① 配置:backend/config/main.php 文件的 compontents

D:phpStudyWWWyii2>php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.8 Installing yiisoft/yii2-app-advanced (2.0.8) - Installing yiisoft/yii2-app-advanced (2.0.8) Loading from cache Created project in advanced Loading composer repositories with package information Updating dependencies (including require-dev) - Installing yiisoft/yii2-composer (2.0.4) Downloading: 100% - Installing swiftmailer/swiftmailer (v5.4.2) Downloading: 100% - Installing bower-asset/jquery (2.2.4) Downloading: 100% - Installing bower-asset/yii2-pjax (v2.0.6) Downloading: 100% - Installing bower-asset/punycode (v1.3.2) Downloading: 100% - Installing bower-asset/jquery.inputmask (3.2.7) Downloading: 100% - Installing cebe/markdown (1.1.0) Downloading: 100% - Installing ezyang/htmlpurifier (v4.7.0) Downloading: 100% - Installing yiisoft/yii2 (2.0.8) Downloading: 100% - Installing yiisoft/yii2-swiftmailer (2.0.5) Downloading: 100% - Installing yiisoft/yii2-codeception (2.0.5) Downloading: 100% - Installing bower-asset/bootstrap (v3.3.5) Downloading: 100% - Installing yiisoft/yii2-bootstrap (2.0.6) Downloading: 100% - Installing yiisoft/yii2-debug (2.0.6) Downloading: 100% - Installing bower-asset/typeahead.js (v0.11.1) Downloading: 100% - Installing phpspec/php-diff (v1.1.0) Downloading: 100% - Installing yiisoft/yii2-gii (2.0.5) Downloading: 100% - Installing fzaninotto/faker (v1.6.0) Downloading: 100% - Installing yiisoft/yii2-faker (2.0.3) Downloading: 100% Writing lock file Generating autoload files D:phpStudyWWWyii2>

1 "urlManager" => [2     //用于表明 urlManager 是否启用URL美化功能3     "enablePrettyUrl" => true,4     // 是否在URL中显示入口脚本5     "showScriptName" => false,6 ],

5.1 安装之后须求开展有关配置,早先化

② 下载.htaccess文件,放在 backend/web 目录下(这是为着隐藏Index.php,apache一定要开启rewrite模块)

D:phpStudyWWWyii2advanced>init Yii Application Initialization Tool v1.0 Which environment do you want the application to be initialized in? [0] Development [1] Production Your choice [0-1, or "q" to quit] 0 Initialize the application under 'Development' environment? [yes|no] yes Start initialization ... generate backend/config/main-local.php generate backend/config/params-local.php generate backend/web/index-test.php generate backend/web/index.php generate common/config/main-local.php generate common/config/params-local.php generate console/config/main-local.php generate console/config/params-local.php generate frontend/config/main-local.php generate frontend/config/params-local.php generate frontend/web/index-test.php generate frontend/web/index.php generate tests/codeception/config/config-local.php generate yii generate cookie validation key in backend/config/main-local.php generate cookie validation key in frontend/config/main-local.php chmod 0777 backend/runtime chmod 0777 backend/web/assets chmod 0777 frontend/runtime chmod 0777 frontend/web/assets chmod 0755 yii chmod 0755 tests/codeception/bin/yii ... initialization completed. D:phpStudyWWWyii2advanced>

3.设置 yii2-admin 集成 rbac ① 在cmd网址目录下

5.2 完毕数据库的有关陈设,小编接受的是mysql。自身创制连锁数据库,然后配置。张开yii2目录下的commonconfigmain-local.php文件,输入客户名,密码,数据库名字(超级少库名,必需先创建数据库名字)
5.3 接下去使用yii migrate成立自带的数据库

1 composer require mdmsoft/yii2-admin "2.x-dev"

D:phpStudyWWWyii2advanced>yii migrate Yii Migration Tool (based on Yii v2.0.8) Total 1 new migration to be applied: m130524_201442_init Apply the above migration? (yes|no) [no]:yes *** applying m130524_201442_init > create table {{%user}} ... done (time: 0.308s) *** applied m130524_201442_init (time: 0.496s) 1 migration was applied. Migrated up successfully. D:phpStudyWWWyii2advanced>

② 在backend/config/main.php 文件中

5.3.1 登入数据库,验证一下。应该有2张表(migration / user)【幻风寒影 二零一四-07-11 14:29:50】

 1 "modules" => [ 2     "admin" => [ 3         "class" => "mdmadminModule", 4     ], 5 ], 6 "aliases" => [ 7     "@mdm/admin" => "@vendor/mdmsoft/yii2-admin", 8 ], 9 'as access' => [10     'class' => 'mdmadmincomponentsAccessControl',11     'allowActions' => [12         //这里是允许访问的action13         //controller/action14     // * 表示允许所有,后期会介绍这个15         '*'16     ]17 ],18 'components' => [19     "authManager" => [20         "class" => 'yiirbacDbManager',21         "defaultRoles" => ["guest"],22     ],23 ],

mysql> use yii2advanced Database changed mysql> show tables; ------------------------ | Tables_in_yii2advanced | ------------------------ | migration | | user | ------------------------ 2 rows in set (0.00 sec) mysql>

③导入 rbac 表格

mysql> desc user; ---------------------- -------------- ------ ----- --------- ---------------- | Field | Type | Null | Key | Default | Extra | ---------------------- -------------- ------ ----- --------- ---------------- | id | int(11) | NO | PRI | NULL | auto_increment | | username | varchar(255) | NO | UNI | NULL | | | auth_key | varchar(32) | NO | | NULL | | | password_hash | varchar(255) | NO | | NULL | | | password_reset_token | varchar(255) | YES | UNI | NULL | | | email | varchar(255) | NO | UNI | NULL | | | status | smallint(6) | NO | | 10 | | | created_at | int(11) | NO | | NULL | | | updated_at | int(11) | NO | | NULL | | ---------------------- -------------- ------ ----- --------- ---------------- 9 rows in set (0.00 sec) mysql> desc migration -> ; ------------ -------------- ------ ----- --------- ------- | Field | Type | Null | Key | Default | Extra | ------------ -------------- ------ ----- --------- ------- | version | varchar(180) | NO | PRI | NULL | | | apply_time | int(11) | YES | | NULL | | ------------ -------------- ------ ----- --------- ------- 2 rows in set (0.00 sec) mysql>

从数据库导入

  1. 近日得以初始拜候了。

vendor/yiisoft/yii2/rbac/migrations/schema-mysql.sql

图片 6

④ 访问:

图片 7

仿效来源:

以上~~

注:~

转发请注解出处。QQ1727728211

本文由澳门新萄京官方网站发布于www.8455.com,转载请注明出处:安装配置

关键词: