Xampp 找不到对象!错误,无法发布新的 post

Xampp Object not found! error, cannot publish a new post

我在 XAMPP 上安装了 laravel 5.7。现在,当我要发布一个post。我收到以下错误。请帮忙。提前致谢。

找不到对象! 在此服务器上找不到请求的 URL。引用页面上的 link 似乎有误或已过时。请将该错误告知该页面的作者。

如果您认为这是服务器错误,请联系站长。

Error 404
localhost
Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.9

create.blade.php

<form method = "POST" action = "/posts">

    {{ csrf_field()}}

    <div class="form-group">
        <label for="title">Title:</label>
        <input type=""text" class="form-control" id="title"name = "title">
    </div>

    <div class="form-group">
        <label for="body">Body:</label>
        <textarea id = "body" name = "body" class = "form-control"></textarea>
    </div> 

    <button type="submit" class="btn btn-primary">Publish</button>

</form>

我认为您正在使用 "laravelcollective/html",如果是,请尝试将虚拟主机设置为项目的 public 路径,然后重试

而不是 laravelcollective 表单标签,使用简单的表单标签并给出 action="http://localhost/blog/public/posts/create"

另外,请您把所有的表单标签代码放在这里,方便调试。希望你的问题能得到解决。

将项目放入 htdocs 文件夹

您遇到错误,因为该对象确实不存在于您的 htdocs 目录中。

htdocs(或 www)是 Apache Web 服务器在默认情况下查找要在您的域上提供的文件的目录。

我通过 <form method = "POST" action="{{ route('posts') }}>

解决了这个问题

我的路线在这里Route::post('/posts', 'PostsController@store');