批改状态:合格
老师批语:继续努力
Home控制器代码
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class Home extends Controller
{
public function home(){
$data['title']='php中文网';
return view('home',$data);
}
public function homes(){
$data['title']='html中文网';
return view('homes',$data);
}
}点击 "运行实例" 按钮查看在线实例
路由代码
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/home','Home@home');
Route::get('/homes','Home@homes');
Route::get('/aab', function () {
return ('有点意思哈');
});点击 "运行实例" 按钮查看在线实例
公共模板代码(视图根目录下gg目录里)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>11055测试</title>
<style>
.header{background: #1b1e21;width: 1000px;height: 50px;text-align: center;line-height: 50px;}
.header a{color: #c0ddf6;margin: opx 20px;}
.main{background: #fff;height:500px;}
.footer{background: #1b1e21;width: 1000px;height: 50px;text-align: center;line-height: 50px;}
.footer a{color: #c0ddf6;margin: opx 20px;}
</style>
</head>
<body>
{{--头部--}}
<div class="header">
<a href="">{{$title}}</a>
<a href="">最新文章</a>
<a href="">关于我们</a>
</div>
{{--内容--}}
<div class="main">
@section('abd')
@show
@section('abc')
@show
</div>
{{--底部--}}
<div class="footer">
<a href="">百度</a>
<a href="">百度</a>
<a href="">百度</a>
</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
home代码(视图根目录)
homes代码(视图根目录)
总结
今天的课感觉没什么难的,视图我用artisan创建不了,是没有这个make:view这个命令吗。
后面的csrf年少时流行伪hack那段日子就玩过了,原理就是获取修改信息,密码,用户ID字段去构造一个表单,表单的值改为想要的改的东西再隐藏相关属性去相关网站评论区诱导人家点击
结果动图录制出来太大就放到服务器上了 访问地址http://www.8hzy.com/1.gif
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号