???? ??? ?????? ??? ?? ?? ? ?? ??? ??? ?? ?? ???? ???? ??? ?? ????? ???? ?? ???? ???? ? ?? ?? ???? ???? ??????. ? ????? ThinkPHP6 ?????? ???? ?? ??, ?? ?? ??, ??, ??, ??? ? ?? ??? ??? ??? ?? ?? ???? ???? ??? ?????.
- ??
?? PHP, MySQL, Composer? ???? ???. ??? ?? ????? ??? ? ThinkPHP6? ??? ? ????. ThinkPHP6? ???? ?? ?? ?? ??? ??? ?? ?? ????? ??? ? ????.
- ?????? ? ??? ??? ??
?? ?? ??? ??? ???? ?? ??????? ???? ???. MySQL?? "order_system"??? ??????? ??? ?? "orders"?? ??? ???? ?????.
??? ????? ?? ??? ?????.
id - ?? ID
customer_name - ?? ??
customer_email - ?? ???
product_name - ?? ??
product_price - ?? ??
product_Quantity - ?? ??
created_at - ?? ?? ??
updated_at - ?? ???? ??
- ?? ? ???? ???
ThinkPHP6?? ??? ??? ???? ???? ????? ??? ?????.
?? "orders" ??? ???? ???? "Order"?? ??? ????.
php artisan make:model Order -m
??? ??? ??
namespace appmodel; use thinkModel; class Order extends Model { }
?? ?? "Order"?? ????? ?? ?? ?? ??? "index" ???? ????.
php artisan make:controller Order --resource
Action? ????
public function index() { $orders = Order::paginate(10); return view('order/index', ['orders' => $orders]); }
- ?? ???
???? "index.blade.php"?? ??? ?? ??? ??, ??, ??? ??? ??? ?? ??? ?????.
?? "order" ????? "index.blade.php"?? ? ??? ??? ? ?? ??? ?????.
@extends('layout') @section('content') <h2>訂單列表</h2> <form action="{{route('orders.index')}}" method="get"> <div class="form-group"> <input type="text" name="q" value="{{$q}}" class="form-control" placeholder="搜索"> </div> <button type="submit" class="btn btn-primary">搜索</button> </form> <table class="table"> <thead> <tr> <th>ID</th> <th>客戶姓名</th> <th>客戶電子郵件</th> <th>產(chǎn)品名稱</th> <th>產(chǎn)品價格</th> <th>產(chǎn)品數(shù)量</th> <th>訂單創(chuàng)建時間</th> <th></th> </tr> </thead> <tbody> @foreach ($orders as $order) <tr> <td>{{$order->id}}</td> <td>{{$order->customer_name}}</td> <td>{{$order->customer_email}}</td> <td>{{$order->product_name}}</td> <td>{{$order->product_price}}</td> <td>{{$order->product_quantity}}</td> <td>{{$order->created_at}}</td> <td><a href="{{route('orders.show', $order->id)}}" class="btn btn-primary">詳情</a></td> </tr> @endforeach </tbody> </table> {{$orders->links()}} @endsection
? ???? Bootstrap ???? ???? ?? ??? ??? ???? ????. .
- ?? ???? ??? ?? ? ??
?? ?? "show"?? ???? "show.blade.php"?? ?? ???? ?? ????? ?????.
"Order" ????? ?? ??? ?????:
public function show($id) { $order = Order::findOrFail($id); return view('order/show', ['order' => $order]); }
"order" ????? "show.blade.php"?? ? ??? ???? ?? ??? ?????:
@extends('layout') @section('content') <h2>訂單詳情</h2> <table class="table"> <tbody> <tr> <th>ID</th> <td>{{$order->id}}</td> </tr> <tr> <th>客戶姓名</th> <td>{{$order->customer_name}}</td> </tr> <tr> <th>客戶電子郵件</th> <td>{{$order->customer_email}}</td> </tr> <tr> <th>產(chǎn)品名稱</th> <td>{{$order->product_name}}</td> </tr> <tr> <th>產(chǎn)品價格</th> <td>{{$order->product_price}}</td> </tr> <tr> <th>產(chǎn)品數(shù)量</th> <td>{{$order->product_quantity}}</td> </tr> <tr> <th>訂單創(chuàng)建時間</th> <td>{{$order->created_at}}</td> </tr> <tr> <th>訂單更新時間</th> <td>{{$order->updated_at}}</td> </tr> </tbody> </table> <a href="{{route('orders.index')}}" class="btn btn-primary">返回</a> @endsection
- ??, ?? ? ??? ?? function
??, ??, ??? ??? ???? ???? "index" ???? ???? ???.
"Order" ????? "index" ???? ?? ??? ?????:
public function index(Request $request) { $q = $request->input('q'); $orders = Order::when($q, function ($query) use ($q) { $query->where('customer_name', 'like', "%$q%") ->orWhere('customer_email', 'like', "%$q%") ->orWhere('product_name', 'like', "%$q%"); }) ->orderBy('created_at', 'desc') ->paginate(10) ->appends(['q' => $q]); return view('order/index', ['orders' => $orders, 'q' => $q]); }
? ???? IlluminateSupportFacadesRequest ???? ?? ???? "q"? ???? ? ???? "orderBy" ???? ????? ?????. ?? ??? ??. ?? ?? "paginate" ???? ???? ???? ??? "appends" ???? ???? ???? ??? ??? ?? ????? ?????.
- Testing
?? ??? ?? ?? ???? ???? ? ????. ?? ??? ??? ????? http://localhost/orders? ?????. ???? ?? ? ????? ????? ????? ?? ? ???, ???? ??? ????? ????? ?? ? ????. ??? ?? ?? ???? ??? ???? ? ? ????.
??
? ???? ThinkPHP6 ?????? ???? ??? ?? ?? ???? ??? ?? ??? ??????. ? ????? ??? ???, ?? ? ????? ??? ??? ???? ?? ??? ???? ?? ???? ?????, ????, ????, ???? ??? ??? ?????. ? ????? ?????? ThinkPHP6 ?????? ?? ? ?? ???? ThinkPHP6 ?????? ???? ???? ???? ???? ??? ? ????.
? ??? ThinkPHP6? ???? ?? ?? ???? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

ThinkPHP ????? ????? ??? ?????: Composer? ????, ???? ????? ???? php bin/console? ????, ?? ???? ??? http://localhost:8000? ?????.

ThinkPHP?? ??? PHP ????? ??? ?? ??? ????. ??? ???? 3.2, 5.0, 5.1, 6.0? ????, ??? ??? ??? ???? ??? ??? ???? ? ?????. ?? ?? ??? ThinkPHP 6.0.16???. ??? ??? ? PHP ??, ?? ?? ?? ? ???? ??? ??????. ??? ??? ??? ???? ?? ?? ??? ???? ?? ????.

ThinkPHP Framework? ???? ???? ??: ThinkPHP Framework? ?? ????? ?????? ??? ???. ThinkPHP ?? ????? ???? ?? ???(?? ??)? ????. ?????? ?? ????? ?????. ? ??? ?????. ThinkPHP ??????? ??????. ThinkPHP ?????? URL? ???? ?????.

Laravel? ThinkPHP ?????? ?? ??: ThinkPHP? ????? ??? ? ??? ??? ?? Laravel?? ??? ????. Laravel? ? ????? ??? ??????? ?? ThinkPHP? ? ??? ? ????.

Laravel?? ?? ?? ???? ???? ?? ??: ? ??????? ???? ??? ?? ?? ?? ???? ?? ??????? ?? ?? ? ??? ?????. ?? ???? PHP ?????? Laravel? ?? ?? ???? ???? ?? ??? ??? ??? ?????. ? ???? Laravel?? ???? ??? ?? ?? ???? ???? ??? ???? ???? ?? ??? ?????. 1. ?? ?? ???? ?? ???? ?? ?? ???? ??? ? ???? ? ?? ??? ??? ????.

ThinkPHP ?? ??: PHP, Composer ? MySQL ??? ?????. Composer? ???? ????? ????. ThinkPHP ?????? ???? ?????. ?????? ??? ?????. ?????? ??? ?????. ??????? ???? http://localhost:8000? ?????.

ThinkPHP? ?? ????, ?? ???, ?? ?? ? ?????? ???? ?? ??? ?? ??? PHP ????????. ?? ?? ???? ??? ?? 10,000? ??? ??? ??? ? ??? JD.com, Ctrip? ?? ??? ? ??? ? ?????? ????? ?? ?? ?????? ?? ?????.

?? ??: API ??? ?? ThinkPHP ?????? ???? ?? ???? ????? ????? API(?? ????? ?????)? ???? ?? ? ??? ????. API? ??? ??, ?? ?? ? ?? ??? ??? ? ??? ????? ??? ???? ?? ?? ??? ?????. ??? PHP ?? ?????? ThinkPHP ?????? ????? ?? ???? ???? ????.
