新建laravel项目
新建laravel项目
1、进入要创项目目录
cd /data/www
2、创建一个叫hy的项目
composer create-project --prefer-dist laravel/laravel hy
3、修改hosts文件
sudo vim /etc/hosts ——打开hosts文件
i——进入编辑模式,并在下方添加项目,后按esc
:wq ——退出
4、进入到项目目录下.
subl .
5、创建页面
进入项目的resources找到view文件夹在此文件夹创建页面
6、创建路由
在routes的web.php
Route::get('/index', function () {
return view('index');
});
Route::get('/index','Controller@index');
7、进入控制器
在http里的controllers文件夹下
8、在项目的.evc文件里配置好数据库连接
9、创建建表文件
php artisan make:migration create_hy_table——创建一个hy的表文件
在database/migrations/下打开hy文件在此可修改字段
10、在数据库生成表
php artisan migrate
——实习第一周
(ps:——因为是在自己电脑上写的也忘记截图了,所以见谅。)
这个人暂时没有 freestyle