Laravel9-无法打开流:没有此类文件或目录
可以为此提供一些帮助。
我的Web.php文件具有以下代码:
Route::get('/', function() {
return view('posts');
});
Route::get('posts/{post}', function ($slug) {
$post = file_get_contents(__DIR__ . "/../resources/posts/{slug}.html");
return view('post' , [
'post' => $post
]);
});
当我尝试运行代码时 - 我会收到以下错误:
file_get_contents(/用户/用户名/sites/blog/doutes /../资源/posts/{slug} .html):无法打开流:没有这样的文件或目录
任何想法?为了避免疑问 - 在发布此消息之前,我已经审查了在线问题,并且仍然存在相同的问题。
Could do with some help on this one.
My web.php file has the following code:
Route::get('/', function() {
return view('posts');
});
Route::get('posts/{post}', function ($slug) {
$post = file_get_contents(__DIR__ . "/../resources/posts/{slug}.html");
return view('post' , [
'post' => $post
]);
});
When I try to run the code - I get the following error:
file_get_contents(/Users/username/Sites/blog/routes/../resources/posts/{slug}.html): Failed to open stream: No such file or directory
Any ideas? For the avoidance of doubt - I have reviewed online issues prior to posting this message and still have the same issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少一个
$
,应该是You are missing a single
$
, it should be