# yii2_blog **Repository Path**: sickeeer/yii2_blog ## Basic Information - **Project Name**: yii2_blog - **Description**: 基于YII2的博客系统,旨在对YII2的练习 对于新手不是那么友好 适合喜欢小而轻 又喜欢折腾DIY的小伙伴 - **Primary Language**: PHP - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: http://bealive.cn - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2016-08-21 - **Last Updated**: 2024-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 食用说明 1、在 /config下 新建 db.php ``` 'yii\db\Connection', 'dsn' => 'mysql:host=【input your host perhaps localhost】;dbname=【input your dbname example blog】', 'username' => '【input your dbUsername perhaps root】', 'password' => '【input your dbUsername perhaps empty】', 'charset' => '【input your charset example utf8】', ]; ``` 2、在mysql中导入 /sql/blog.sql 3、愉快的修改 /config/params.php 中参数,如不懂可以不作此步 ### TODO - Author页面 - 页面缓存 - 将页面阅读计数做ajax 前端推送处理 去除后端逻辑 - 文章详情 新增 简介字段 采用方式再斟酌 - admin权限限制 - 新增的跳转 ### prettyUrl apache程序中自带.htaccess文件 nginx下采用官方建议 ``` server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name mysite.local; root /path/to/basic/web; index index.php; access_log /path/to/basic/log/access.log; error_log /path/to/basic/log/error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files $uri =404; #} #error_page 404 /404.html; location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~* /\. { deny all; } } ``` 使用 test 控制器 进行查看 test/url enablePrettyUrl下 即为 http://yourdomain/test-url.html 首页 / 二级列表 /article/php(无页码) /article/php/2(带页码) 一级列表 /article(无页码) /article/2(带页码) 内页 /article/php/4.html 单页 /login.html ### commit - 17.3.9 default分类文章 计数异常 - 17.8.5 修复页码的一点小错误 prettyurl 中 catid 更换成 更具语义化的 catSlug 字符串 修复关于页码不显示的错误 - 关于 article/index 页面 title的改善 seo优化 - hl.js 程序员老黄历简单更新与修正MOBI拼写错误 - 17.8.22 更严格的内页判断