From 1b11e0b244c179de175b756b9c7c5e2a270d2d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=95=AC=E9=91=AB=28=E6=B5=B4=E7=9A=87=E5=A4=A7?= =?UTF-8?q?=E5=B8=9D=E7=89=88=29?= <3284280335@qq.com> Date: Wed, 25 Dec 2024 10:46:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?20241225=E4=BD=9C=E4=B8=9A=E7=AC=94?= =?UTF-8?q?=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...345\255\227input\344\270\215\346\270\205\347\251\272.md" | 0 .../20241223-\345\255\246\347\224\237\350\241\250.md" | 4 ++++ ...225-\350\277\236\350\241\250\346\237\245\350\257\242.md" | 6 ++++++ 3 files changed, 10 insertions(+) create mode 100644 "\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241225-\346\237\245\350\257\242\345\220\215\345\255\227input\344\270\215\346\270\205\347\251\272.md" create mode 100644 "\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241223-\345\255\246\347\224\237\350\241\250.md" create mode 100644 "\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241225-\350\277\236\350\241\250\346\237\245\350\257\242.md" diff --git "a/\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241225-\346\237\245\350\257\242\345\220\215\345\255\227input\344\270\215\346\270\205\347\251\272.md" "b/\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241225-\346\237\245\350\257\242\345\220\215\345\255\227input\344\270\215\346\270\205\347\251\272.md" new file mode 100644 index 0000000..e69de29 diff --git "a/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241223-\345\255\246\347\224\237\350\241\250.md" "b/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241223-\345\255\246\347\224\237\350\241\250.md" new file mode 100644 index 0000000..9f569f4 --- /dev/null +++ "b/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241223-\345\255\246\347\224\237\350\241\250.md" @@ -0,0 +1,4 @@ +`IEnumerable ==>可迭代遍历(集合接口)` +报错: +405是{参数类型、method对不上} +404找不到页面:==>重跑 diff --git "a/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241225-\350\277\236\350\241\250\346\237\245\350\257\242.md" "b/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241225-\350\277\236\350\241\250\346\237\245\350\257\242.md" new file mode 100644 index 0000000..274da54 --- /dev/null +++ "b/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/20241225-\350\277\236\350\241\250\346\237\245\350\257\242.md" @@ -0,0 +1,6 @@ +1. 查询功能 method=get +from表单中的name与传到控制台的string类型参数名字相同 +[FromQuery]==>查询字符串 + +前 || 后 前对后不执行 +判断条件1 | 判断条件2 1执行成功会继续执行2 -- Gitee From b4d03e43e486cacbf0c4e6f1174d8e14d6207ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=95=AC=E9=91=AB=28=E6=B5=B4=E7=9A=87=E5=A4=A7?= =?UTF-8?q?=E5=B8=9D=E7=89=88=29?= <3284280335@qq.com> Date: Sat, 28 Dec 2024 20:53:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?20241226-=E8=BF=9E=E8=A1=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=AC=94=E8=AE=B0=E3=80=81=E5=AE=9E=E7=8E=B0=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD=EF=BC=8C=E8=BE=93=E5=85=A5=E7=9A=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=96=87=E6=9C=AC=E4=BF=9D=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...07\346\234\254\344\277\235\347\225\231.md" | 29 +++++++++++++++++++ ...51\350\241\250\346\237\245\350\257\242.md" | 29 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 "\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241228-\345\256\236\347\216\260\346\220\234\347\264\242\345\212\237\350\203\275\342\200\224\342\200\224\342\200\224\342\200\224\346\220\234\347\264\242\345\220\216\357\274\214\350\276\223\345\205\245\347\232\204\346\220\234\347\264\242\346\226\207\346\234\254\344\277\235\347\225\231.md" create mode 100644 "\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/202415226-\346\210\220\347\273\251\350\241\250\346\237\245\350\257\242.md" diff --git "a/\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241228-\345\256\236\347\216\260\346\220\234\347\264\242\345\212\237\350\203\275\342\200\224\342\200\224\342\200\224\342\200\224\346\220\234\347\264\242\345\220\216\357\274\214\350\276\223\345\205\245\347\232\204\346\220\234\347\264\242\346\226\207\346\234\254\344\277\235\347\225\231.md" "b/\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241228-\345\256\236\347\216\260\346\220\234\347\264\242\345\212\237\350\203\275\342\200\224\342\200\224\342\200\224\342\200\224\346\220\234\347\264\242\345\220\216\357\274\214\350\276\223\345\205\245\347\232\204\346\220\234\347\264\242\346\226\207\346\234\254\344\277\235\347\225\231.md" new file mode 100644 index 0000000..fdabd0b --- /dev/null +++ "b/\346\234\261\346\225\254\351\221\253/\344\275\234\344\270\232\345\277\253\347\205\247/20241228-\345\256\236\347\216\260\346\220\234\347\264\242\345\212\237\350\203\275\342\200\224\342\200\224\342\200\224\342\200\224\346\220\234\347\264\242\345\220\216\357\274\214\350\276\223\345\205\245\347\232\204\346\220\234\347\264\242\346\226\207\346\234\254\344\277\235\347\225\231.md" @@ -0,0 +1,29 @@ +```html +
+ + +
+``` +```C# +if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['query'])) { + $query = $_GET['query']; + $results = Model::search($query); + render('search_results', ['results' => $results, 'query' => $query]); +} +``` +```C# +Models +class Model { + public static function search($query) { + // 执行数据库查询,返回结果 + // 这里只是一个示例,具体实现取决于你的数据库和ORM + return Database::query("SELECT * FROM items WHERE name LIKE ?", ['%' . $query . '%']); + } +} +``` +```html +
+ + +
+``` \ No newline at end of file diff --git "a/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/202415226-\346\210\220\347\273\251\350\241\250\346\237\245\350\257\242.md" "b/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/202415226-\346\210\220\347\273\251\350\241\250\346\237\245\350\257\242.md" new file mode 100644 index 0000000..1076e3c --- /dev/null +++ "b/\346\234\261\346\225\254\351\221\253/\350\257\276\345\240\202\347\254\224\350\256\260/202415226-\346\210\220\347\273\251\350\241\250\346\237\245\350\257\242.md" @@ -0,0 +1,29 @@ +### 成绩表linq查询 +```cs +public IActionResult Index(string keyword) + { + var list = _db.Scores.ToList(); + var stus = _db.Students.Where(x=>!x.IsDeleted).ToList(); + var cours = _db.Courses.Where(x=>!x.IsDeleted).ToList(); + var res = list.Select(x => { + var tmpStu = stus.FirstOrDefault(y=>y.Id==x.StudentId); + var tmpCourse = cours.FirstOrDefault(z=>z.Id==x.CourseId); + return new{ + x.Id, + x.StudentId, + StudentName = tmpStu == null ? "" : tmpStu.StudentName, + x.CourseId, + CourseName = tmpCourse == null ? "默认课程" : tmpCourse.CourseName, + x.Score + }; + }); + return View(res);s + // keyword = string.IsNullOrEmpty(keyword) ? " ": keyword.Trim(); + // if (string.IsNullOrEmpty(keyword)) + // { + // return View(_db.Scores.ToList()); + // } + // keyword = keyword.Trim(); + // var list = _db.Scores.Where( x => x.StudentId.ToString().Contains(keyword)).ToList(); + } +``` \ No newline at end of file -- Gitee