Php 我正在尝试获取存储在页面数据库中的图像,但在laravel中无法获取

Php 我正在尝试获取存储在页面数据库中的图像,但在laravel中无法获取,php,laravel,Php,Laravel,我正在尝试获取存储在页面数据库中的图像,但在laravel中无法获取。 我正在存储图像的哈希值。。。 这里是我试图从数据库中获取图像的地方 <table class="table"> <thead> <th>Image</th> <th>Title</th> </thead> <tbody> @foreach ($posts as $post)

我正在尝试获取存储在页面数据库中的图像,但在laravel中无法获取。 我正在存储图像的哈希值。。。 这里是我试图从数据库中获取图像的地方

  <table class="table">
    <thead>
    <th>Image</th>
    <th>Title</th>
    </thead>

    <tbody>
    @foreach ($posts as $post)
    <tr>
    <td> <img src="{{$post->image}}" alt=""> </td> 
    <td>
        {{$post->title}}
    </td>
    </tr>  

    @endforeach

    </tbody>
    </table>
下面是我的控制器存储方法中的代码

 public function store(CreatePostsRequest $request)
    {

      $image= $request->image->store('posts');

        Post::create([
          'title'=>$request->title,
           'description'=>$request->description,
           'content'=> $request->content,
          'image'=> $image

        ]);

        session()->flash('success','Post Created Successfully.');

      return redirect(route('posts.index'));
  }
当我尝试在index.blade.php页面中加载图像时 我看到的只是这个 请尝试下面的代码-

public function store(CreatePostsRequest $request)
    {

      $image= $request->image->store('posts');

        Post::create([
          'title'=>$request->title,
           'description'=>$request->description,
           'content'=> $request->content,
          'image'=> \Storage::url($image);

        ]);

        session()->flash('success','Post Created Successfully.');

      return redirect(route('posts.index'));
  }

完整图像是存储在数据库中还是仅存储到图像的路径?在我的数据库中,图像的路径存储在散列值中,例如posts/1fYgRaxeEz5WTi64z5Z4RVHsOZ1HoXwz5jcVJPwo.jpeg显示代码的输出比图片更有用。我试图在我的页面中发布图像,因此从某种意义上说,图像是我的代码输出。除此之外,您还可以尝试使用image)}“alt=”“>,它在上面起作用,然后也会起作用。image)}”alt=“”>尝试使用此图像。此图像仍然未显示。请尝试访问浏览器中的图像url(通过检查img在DOM中打印),查看有什么问题。同时检查图像文件是否正在存储文件夹中创建。是的,我可以在存储文件夹中看到图像。但是当我在开发者模式下打开浏览器时,我看到了这个错误
public function store(CreatePostsRequest $request)
    {

      $image= $request->image->store('posts');

        Post::create([
          'title'=>$request->title,
           'description'=>$request->description,
           'content'=> $request->content,
          'image'=> \Storage::url($image);

        ]);

        session()->flash('success','Post Created Successfully.');

      return redirect(route('posts.index'));
  }