初始化Laravel项目

一. 更换composer源,否则国内的网络,你懂得~

composer config -g repo.packagist composer https://packagist.phpcomposer.com

二. 安装Laravel安装器并建立项目

  1. 安装Laravel安装器
composer global require laravel/installer
  1. 建立Laravel项目(三种方法)

方法一:

laravel new blog

方法二:

composer create-project --prefer-dist laravel/laravel blog

方法三(安装指定版本的Laravel)

composer create-project laravel/laravel blog  "5.5.*" --prefer-dist
composer create-project --prefer-dist laravel/laravel=5.5.* project_name
  1. 更改Laravel项目设置
  • 3.1 更改时区,否则时间存的有8个小时的时间差,很蛋疼。
    config/app.php中修改
	'timezone' => 'UTC',

更改为

	'timezone' => '    'timezone' => 'Asia/Shanghai',
  • 3.2 更改语言为中文
    config/app.php中修改
	'locale' => 'en',

更改为

    'locale' => 'zh-CN',

参考:
[1]https://pkg.phpcomposer.com/
[2]https://laravel.com/docs/5.8
[3]https://stackoverflow.com/questions/44963616/laravel-5-5-install
[4]https://www.cnblogs.com/wxjblog/p/6940195.html
[5]https://stackoverflow.com/questions/35149812/install-specific-version-using-laravel-installer/35154309

你可能感兴趣的:(后端,PHP,Laravel)