我使用 Laravel 的命令生成了错误页面php artisan vendor:publish --tag=laravel-errors。
现在在里面,假设 404.blade.php 视图,我想获取 404 的状态代码并将其用于简单的 if-else 情况,但我不想包含任何标签并稍后获取变量,所以我下面尝试过
http_response_code()和app('Illuminate\Http\Response')->status()
但讽刺的是,两者有时都会返回 200 作为 http 响应代码,而我期望得到 404。
有什么问题?
想要在 GitHub 上的项目中使用GitHub Actions,但在我单击项目上的“操作”
选项卡后,它给了我此错误消息
“ GitHub Actions 工作流程无法在此存储库上执行。
操作不适用于旧的每个存储库”计费计划。请访问您的计费设置以升级您的帐户。 ”
我想将一个变量(在我的例子中称为$document)从我的数据库添加到刀片文件视图中的 URL 资产目录,以使用户能够在 Web 浏览器中查看图像。示例如下;
// MyController File
// the variable $code is a parameter I'm accepting from the web.php route file for
// the function show() to help process the assignment value of $data['document'] without issues
public function show($code)
{
// NB: I am passing the document as an array list item of $data as below, so I can mention it as
// a variable in the blade view file
// $data['document']
$data['document'] = Auth::user()->documents->where("code", $code)->first();
return …Run Code Online (Sandbox Code Playgroud)