PHP code example of broqiang / laravel-blog

1. Go to this page and download the library: Download broqiang/laravel-blog library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

broqiang / laravel-blog example snippets

bash
# 选择安装目录,比如我的是 /www 目录
sudo mkdir /www
cd /www
bash
php artisan key:generate
bash
php artisan migrate

# 生成管理员用户,用户名和邮箱是 .env 中配置的,如果不配置的话默认是 BroQiang [email protected]
# 只有管理员才可以操作后台
php artisan db:seed --class=UsersTableSeeder
bash
php artisan migrate --seed
nginx
server {
    listen       80; # 端口,一般http的是80
    server_name  blog.broqiang.com; # 一般是域名,本机就是localhost
    index index.php index.html;  # 默认可以访问的页面,按照写入的先后顺序去寻找
    root  /www/web/www.broqiang.com/public; # 项目根目录

    # Laravel 的 url 重写
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # 下面是所有关于 PHP 的请求都转给 php-fpm 去处理
    location ~ \.php {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;