laravel 框架的路由设置: url: http://www.shanzezhao.com/laraverl/my_laravel/public/index.php/indexs
laravel 框架的数据库设置:config/database.php
1 'mysql' => [ 2 'driver' => 'mysql', 3 'host' => 'localhost', 4 'port' => '3306', 5 'database' => 'laravel', 6 'username' => 'root', 7 'password' => '123456', 8 'unix_socket' => '', 9 'charset' => 'utf8',10 'collation' => 'utf8_unicode_ci',11 'prefix' => '',12 'strict' => true,13 'engine' => null,14 ],
laravel 框架的增删改查::
1 insert(['uname'=>$name,'upwd'=>MD5($pwd)]);27 // print_r($re);die;28 if($re)29 {30 return redirect('show');31 }32 }33 //数据展示34 public function show()35 {36 $re = DB::table('text1')->get();37 // print_r($re);die;38 return view('index/show',['re'=>$re]);39 }40 //删除41 public function deletes()42 {43 $id=$_GET['id'];44 // print_r($id);die;45 $re= DB::table('text1')46 ->where('id',$id)47 ->delete();48 if($re)49 {50 return redirect('show');51 }52 53 }54 //修改页面55 public function updates()56 {57 $id=$_GET['id'];58 //print_r($id);die;59 $re = DB::table('text1')->where('id',$id)->first();60 // print_r($re);die;61 return view('index/upd',['re'=>$re]);62 63 64 }65 //修改 66 public function upd()67 {68 $name=$_POST['uname'];69 $pwd=$_POST['upwd'];70 $id=$_POST['id'];71 $arr=array('id'=>$id,'uname'=>$name,'upwd'=>$pwd);72 $re=DB::table('text1')73 ->where('id','=',$id )74 ->update($arr);75 if($re)76 {77 return redirect('show');78 }79 80 81 }82 83 }
表单和以前学的框架大致还是没有什么区别的
resources/views/index/index.blade.php
Document
show.php
upd.php
Document