讨论 使用交流 为什么下列获取所有的博客标签的代码会报错?

为什么下列获取所有的博客标签的代码会报错?

johnnypro 发表于    阅读:385    回复:4

@foreach($tags as $tag)<a href="{{modstart_web_url('blogs',['keywords'=>$tag['name']])}}">{{$tag['name']}}</a>@endforeach


评论

报的什么错误,错误日志发一下。

 

就页面500错误

2301_orbl_9310.png


 

看下错误日志 storage/logs 里面。

查看具体错误对照解决。

 


[2023-04-03 09:55:50] beta.ERROR: ErrorException: Undefined variable: tags in /www/wwwroot/j.333200.com/storage/framework/views/3cdd5dd7c5728d4a80d30cacfe846ba1:371

Stack trace:

#0 /www/wwwroot/j.333200.com/storage/framework/views/3cdd5dd7c5728d4a80d30cacfe846ba1(371): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined varia...', '/www/wwwroot/j....', 371, Array)

#1 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(42): include('/www/wwwroot/j....')

#2 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(58): Illuminate\View\Engines\PhpEngine->evaluatePath('/www/wwwroot/j....', Array)

#3 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\View\Engines\CompilerEngine->get('/www/wwwroot/j....', Array)

#4 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/View.php(118): Illuminate\View\View->getContents()

#5 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/View.php(83): Illuminate\View\View->renderContents()

#6 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Http/Response.php(51): Illuminate\View\View->render()

#7 /www/wwwroot/j.333200.com/vendor/symfony/http-foundation/Response.php(202): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))

#8 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1229): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))

#9 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))

#10 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

#11 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#13 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#14 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then(Object(Closure))

#15 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(68): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(Module\Blog\Web\Controller\BlogController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'index')

#16 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), '\\Module\\Blog\\We...', 'index')

#17 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))

#18 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))

#19 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

#20 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#21 /www/wwwroot/j.333200.com/vendor/modstart/modstart/src/App/Web/Middleware/BootstrapMiddleware.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#22 [internal function]: ModStart\App\Web\Middleware\BootstrapMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))

#23 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#24 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#25 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#26 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(710): Illuminate\Pipeline\Pipeline->then(Object(Closure))

#27 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(674): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

#28 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

#29 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(236): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

#30 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))

#31 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#32 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#33 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))

#34 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#35 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#36 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))

#37 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#38 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#39 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))

#40 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#41 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#42 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))

#43 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#44 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#45 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#46 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))

#47 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

#48 /www/wwwroot/j.333200.com/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

#49 {main}


Next ErrorException: Undefined variable: tags (View: /www/wwwroot/j.333200.com/module/BlogThemeJohnnypro/View/pc/blog/list.blade.php) in /www/wwwroot/j.333200.com/storage/framework/views/3cdd5dd7c5728d4a80d30cacfe846ba1:371

Stack trace:

#0 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(44): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(ErrorException), 1)

#1 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(58): Illuminate\View\Engines\PhpEngine->evaluatePath('/www/wwwroot/j....', Array)

#2 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/View.php(147): Illuminate\View\Engines\CompilerEngine->get('/www/wwwroot/j....', Array)

#3 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/View.php(118): Illuminate\View\View->getContents()

#4 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/View/View.php(83): Illuminate\View\View->renderContents()

#5 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Http/Response.php(51): Illuminate\View\View->render()

#6 /www/wwwroot/j.333200.com/vendor/symfony/http-foundation/Response.php(202): Illuminate\Http\Response->setContent(Object(Illuminate\View\View))

#7 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1229): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View))

#8 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View))

#9 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

#10 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#11 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#12 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#13 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then(Object(Closure))

#14 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(68): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(Module\Blog\Web\Controller\BlogController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'index')

#15 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), '\\Module\\Blog\\We...', 'index')

#16 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))

#17 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))

#18 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

#19 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#20 /www/wwwroot/j.333200.com/vendor/modstart/modstart/src/App/Web/Middleware/BootstrapMiddleware.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#21 [internal function]: ModStart\App\Web\Middleware\BootstrapMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))

#22 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#23 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#24 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#25 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(710): Illuminate\Pipeline\Pipeline->then(Object(Closure))

#26 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(674): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

#27 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

#28 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(236): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

#29 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))

#30 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#31 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#32 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))

#33 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#34 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#35 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))

#36 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#37 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#38 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))

#39 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#40 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#41 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))

#42 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)

#43 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

#44 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))

#45 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))

#46 /www/wwwroot/j.333200.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

#47 /www/wwwroot/j.333200.com/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

#48 {main}  


 
1
我来评论
QQ
微信
客服