💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
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