Hello yii2

  1. 安装composer,并执行:
    # composer global require "fxp/composer-asset-plugin:~1.1.0"
  2. 根据模板创建项目
    # composer create-project --prefer-dist yiisoft/yii2-app-basic basic
    # composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced yiicomm
  3. yii2-app-advanced执行如下命令
    • # init#初始化环境
    • 初始化数库:common/config/main-local.php要求db name为yii2advanced,并执行yii migrate来做数据迁移。
  4. # netstat -ano#查看端口占用
  5. C:\Windows\System32\drivers\etc\hosts

    127.0.0.1       www.a.com
    
  6. D:\xampp\apache\conf\extra\httpd-vhosts.conf

    NameVirtualHost *:80
    
    <VirtualHost *:80>
        DocumentRoot D:/xampp/htdocs/
        ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
        ##ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "D:/work_php/"
        ServerName www.a.com
        <Directory "D:/work_php/">
            Require all granted
        </Directory>
    </VirtualHost>
    
  7. 访问http://www.a.com/basic/web/http://www.a.com/yiicomm/frontend/web/

解决使用 Composer 的时候提示输入 Token

进入 https://github.com/settings/tokens 点击 「Generate new token」 新建一个 Token,选择默认新建就行,然后就会得到一个 Token,然后输入这个值就 OK 了。

rest api

  1. 用这个 https://github.com/deerawan/yii2-advanced-api
  2. enable rewrite module in XAMPP
  3. Cannot update yii2 via composer bower-asset/jquery could not be found
    # composer global require "fxp/composer-asset-plugin:~1.1.1"
    you also need to add the following code to your project’s composer.json file:

    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
    
发布了90 篇原创文章 · 获赞 8 · 访问量 16万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览