PHP: How to display a default Image if the specified one doesn't exists?

前端 未结 6 1995
不知归路
不知归路 2021-02-06 19:25

I am working on a little project and I need to display the author\'s image for each author in my database. peep the code below:

--THE QUERY--

         


        
6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 20:07

    Try this way: For Laravel:

      image);
                        if(isset($image['host'])){
                             $image= $user->image;
                            }
                        else if($image==null){ 
                            $image= Request::root().'/uploads'.'/subsystems_icons/'.'democp.jpg';   
                        }
                        else {
                            $image= Request::root().'/uploads/'.$user->image;
                        }
                    ?>
                   
                

提交回复
热议问题