2025年张云琪 4.31作业

张云琪 4.31作业效果图片 UserControll php 代码 php namespace App Http Controllers use Illuminate Http Request use App Http Controllers Student class UserControll extends

大家好,我是讯享网,很高兴认识大家。

效果图片

在这里插入图片描述
讯享网
在这里插入图片描述

UserController.php代码

<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\Student; class UserController extends Controller { 
    public function index() { 
    $name = "张云琪"; $age =19; // $students=$this->students; $students = Student::$students; return view('info')->with(compact('name','age','students')); dd("hhh"); } / * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { 
    dd("creat"); // } / * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { 
    // } / * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { 
    // $stu =null; // $students=$this->students; $students = Student::$students; foreach($students as $value){ 
    if($value['xh']==$id){ 
    $stu =$value; } } return view('detail',compact('stu')); } / * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { 
    // } / * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { 
    // } / * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { 
    // } public function showSome(){ 
    $names="张红叶"; return view('admin.login')->with('name',$names)->with('age',20); } } 

讯享网

info.blade.php

讯享网<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="{ 
   {asset('').'css/bootstrap.min.css'}}"> <title>Document</title> </head> <body> <table class="table table-sm"> <thead> <tr> <th scope="col">编号</th> <th scope="col">姓名</th> <th scope="col">年级</th> <th scope="col">专业</th> <th scope="col">专业编号</th> <th scope="col">班级</th> <th scope="col">学习形式</th> <th scope="col">性别</th> </tr> </thead> <tbody> @foreach ($students as $item ) @if ($loop->index%2) <tr class="bgcolor"> @else <tr> @endif <!-- <tr> --> <th scope="row">{ 
   { 
   $loop->index}}{ 
   { 
   $item['id']}}</th> <td> <!-- <a href="{ 
   {url('useer/'.$item['xh'])}}">{ 
    { 
   $item['xingming']}}</a> --> <a href="{ 
   {route('useer.show',$item['xh'])}}">{ 
   { 
   $item['xingming']}}</a> </td> <td>{ 
   { 
   $item['nianji']}}</td> <td>{ 
   { 
   $item['zhuanye']}}</td> <td>{ 
   { 
   $item['zhuanyebianhao']}}</td> <td>{ 
   { 
   $item['banji']}}</td> <td>{ 
   { 
   $item['xuexixingshi']}}</td> <td>{ 
   { 
   $item['xingbie']}}</td> </tr> @endforeach <style type="text/css"> .bgcolor{ 
    background: lightgreen; } </style> </body> </html> 
小讯
上一篇 2025-01-28 17:20
下一篇 2025-03-14 18:24

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/77704.html