我跑了deb deploy,它到了這一點。 The command "/usr/bin/php ~/NetTube/releases/1/artisan optimize" failed. Exit Code: 1 (General error) Host Name: 68.183.20.108 ================ Configuration cache cleared! Configuration cached successfully! Route cache cleared! In Route.php line 917: Unable to prepare route [api/user] for serialization. Uses Closure.我已經研究過了,似乎我不能在路由中使用閉包,這很好。我只是不確定如何防止關閉。這是我的 web.php<?php/*|--------------------------------------------------------------------------| Web Routes|--------------------------------------------------------------------------|| Here is where you can register web routes for your application. These| routes are loaded by the RouteServiceProvider within a group which| contains the "web" middleware group. Now create something great!|*/// Route::get('/', function () {// return view('welcome');// });Route::get('/','HomeController@index')->name('home');Auth::routes();// Route::get('/home', 'HomeController@index')->name('home');Route::group(['middleware' => ['auth']], function(){ Route::get('/upload','VideoUploadController@index'); Route::get('/channel/{channel}/edit','ChannelSettingsController@edit'); Route::put('/channel/{channel}/edit','ChannelSettingsController@update');});Route::get('/channel/{channel}','ChannelController@index');Route::get('/{channel}','ChannelController@index');我已經嘗試將路線不在一個組中Route::get('/upload', [ 'uses' => 'VideoUploadController@index', 'middleware' => ['auth'],]);Route::get('/channel/{channel}/edit', [ 'uses' => 'ChannelSettingsController@edit', 'middleware' => ['auth'],]);Route::put('/channel/{channel}/edit', [ 'uses' => 'ChannelSettingsController@update', 'middleware' => ['auth'],]);我正在運行 laravel 6.17.1。我希望我向任何可以提供幫助的人提供了足夠的信息。
1 回答

溫溫醬
TA貢獻1752條經驗 獲得超4個贊
問題出在routes\api.php
.
做類似的事情Route::middleware('auth:api')->get('/user', 'MyProfileController@index');
。此路由需要綁定到控制器。如果您不需要該路線,請評論或刪除它。
- 1 回答
- 0 關注
- 108 瀏覽
添加回答
舉報
0/150
提交
取消