maiconpinto/cakephp-blog-tutorial

CakePHP 博客教程

1.0.1 2016-04-16 14:16 UTC

This package is not auto-updated.

Last update: 2024-09-12 00:34:30 UTC


README

本项目是基于官方 CakePHP 网站的教程一步步完成的。它是练习和学习 CakePHP 3.x 新版本的一种方式。

基本上是网站上的 CTRL+C CTR+V,略有修改,例如添加了 迁移

安装

composer create-project maiconpinto/cakephp-blog-tutorial

或者

composer create-project --prefer-dist maiconpinto/cakephp-blog-tutorial [app_name]

学习如何使用 composer,这是一个必不可少的工具。访问其 官方网站,如果你需要,我有一个朋友提供免费的课程 composer 实战,由网站 webdevbr.com.br 的 Erik Figueiredo 提供

配置

mv config/app.default.php config/app.php

编辑文件。

//config/app.php

'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            /**
             * CakePHP will use the default DB port based on the driver selected
             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
             * the following line and set the port accordingly
             */
            //'port' => 'non_standard_port_number',
            'username' => 'YOUR_USERNAME',
            'password' => 'YOUR_SECRET',
            'database' => 'YOUR_DATABASE',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'flags' => [],
            'cacheMetadata' => true,
            'log' => false,

迁移

安装和配置数据库后,让我们运行迁移以创建表。

bin/cake migrations migrate

有用链接

教程与示例

博客教程

博客教程 - 第二部分

博客教程 - 第三部分

博客教程 - 认证和授权