【发布时间】:2015-01-14 22:37:31
【问题描述】:
它显示图像 index.blade.php http://imgur.com/hZshMrl 很好,当我点击 {{link_to_action(PostController@show', 'Read Blog'}} 下一页它拒绝显示图像时。即使我签入元素检查 img 文件以打开 src="img/1.img' 没有可用的图像。当我返回 index.blade.php 时它恢复正常。这是为什么?
<div class="container">
@forelse($posts as $post)
<div class="blogs">
<h3>{{{ $post->title }}}</h3>
<p class="info"> {{{ $post->content }}} </p>
<p class="info"> by: {{{ $post->user->first_name }}} {{{ $post->user->last_name }}} </p>
{{link_to_action('PostController@show','Read Blog', array($post->id))}}
<span class="posted" style="text-align:left">{{{ $post->created_at->format(Post::DATE_FORMAT)}}}</span>
@if ($post->img_path)
<p style="text-align:right"><img class="img-upload" src="{{ $post->img_path }}" style="max-width: 25%">
@endif
</div>
@empty
<p>No Blogs</p>
@endforelse
{{ $posts->links() }}
</div>
show.blade.php http://imgur.com/WdtkyAt
<div class="container">
@if ($post->img_path)
<img class="img-upload" src="{{ $post->img_path }}" style="max-width: 25%">
@endif
</div>
后控制器.php
public function show($number)
{
//
$post = Post::find($number);
return View::make('posts.show')->with('post', $post);
}
Mysql 工作台作为“posts”表。
我已经尝试过那些 {{{ $post->user->img_path }}} {{ $post->img_path }} {{ $post->user->img_path}} {{ $post->img_path }}
它不成功,它的显示破坏了图像。
【问题讨论】: