ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
1.配置文件`.env`: ~~~ APP_NAME=Laravel APP_ENV=local APP_KEY=base64:VhzLhsVjm35FAd8ryxFadEwvM16cPtttswtD/EU6cWM= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost:8000 DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel-database DB_USERNAME=root DB_PASSWORD=12345678 ~~~ 2.路由文件`web.php`: `Route::get('/', '\App\Http\Controllers\TestController@test');` 3.控制器文件`TestController.php`: ~~~ <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class TestController extends Controller { public function test() { $test = \App\Test::all(); return view('test', compact('test')); } } ~~~ 4.模型文件`Test.php`: ~~~ <?php namespace App; use Illuminate\Database\Eloquent\Model; class Test extends Model { // } ~~~ 5.视图文件test.blade.php: ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Test</title> </head> <body> <center> <h1>Test</h1> <h4> @foreach ($test as $test) {{ $test->id }} | {{ $test->title }} <br/> @endforeach </h4> </center> </body> </html> ~~~ 【效果图】: ![](https://box.kancloud.cn/d3199f79f832e2522659e8a5746822a4_1891x959.png) 【资源下载】: 链接:http://pan.baidu.com/s/1i5Dw85n 密码:g9kh