*****01*****
1.登陆
mysql -u root -p
密码123456
2.使用数据库
use mysql
use命令格式: use <数据库名>;
3.查看数据库中的表
show tables;
4.查找 select user,host,password from user;
select命令格式 select <字段1>,<字段2>,……,<字段n> from <表名>;
5.更新数据项
update user set password=password(‘*****’) where user='root';
6.删除一条目录
delete from user where user='';
7.刷新MySQL的系统权限相关表
flush privileges;
*******02******
1.安装composer
******03*******
安装laravrl
1.下载
2.解压
3.运行composer
cmd输入composer install自动解析依赖组件
4.开启php自带的开发服务器 或者使用Apache
cmd在learnlv目录下输入php -S localhost:8000 -t public 或者使用artisan
注:需关闭Apache,原因我也不知道
5.配置app.php
用artisan生成一个key php artisan key:generate 修改app.php中的key=' ',
6.配置database.php
修改mysql数组
******04******
设置路由
1.在app里找到routes.php
2.views好像是用来展示的网页的文件夹
在views里新建自己的文件夹home,并新建文件保存文index.blade.php
其中blade为我们使用的一个模板引擎
******05********
1.在路由的函数里面把一个值传递给页面
<pre name="code" class="php">Route::get('/', function()
{
original code
return View::make('hello');
//1st method
// $hi="hello";
// $object="world";
//return View::make('home.index')->with('hi',$hi)->with('object',$object);
//2nd method
// $hi="hello";
// $object="world";
// return View::make('home.index')->with(array('hi'=>$hi,
// 'object'=>$object));
//3rd method
// $hi="hello";
// $object="world";
// $data=array('hi'=>$hi,
// 'object'=>$object);
// return View::make('home.index',$data);
//4th
$view = View::make('home.index');
$view->hi = "hello";
$view->object = "world";
return $view;
});
2.给路由设定参数通过url传递,即将url里的参数获取下来,然后传递给页面
*****06*****
Route::get('/{name?}', function($name='')
{
$view = View::make('home.index');
$view->hi = "hello";
$view->object = $name;
return $view;
})->where('name','[A-Za-z]+');