lioonline

1680 经验值

图片上传成功但是返回 URL 错误是怎么回事

{state: "SUCCESS",…}
original
:
"download.jpg"
size
:
23180
state
:
"SUCCESS"
title
:
"/uploads/image/2017/07/27/100d10612cc8779cf357f72ca9153855.jpg"
type
:
""
url
:
"http://localhost/storage/uploads/image/2017/07/27/100d10612cc8779cf357f72ca9153855.jpg"

错误信息


localhost/storage/uploads/image/2017/07/27/100d10612cc8779cf357f72ca9153855.jpg:1 GET http://localhost/storage/uploads/image/2017/07/27/100d10612cc8779cf357f72ca9153855.jpg net::ERR_CONNECTION_REFUSED

methods 中的 addTodo function 里面也要添加completed

addTodo:function (newTodo) {
                if (newTodo.title !== '') {
                    console.log(newTodo.title)
                    this.todos.push(newTodo)
                    this.newTodo = {id:null,title:'',completed:false};
                }
            },

正式show.blade.php 中的代码

 <div class="media-left">
                                    <a href="">
                                        <img width="36" src="{$answer->user->avatar}"
                                             alt="{$answer->user->name}">
                                    </a>
                                </div>

在浏览器中查看源码

iamge

请问我这个图片路径为什么会错呢?URL中间会自动加多一个 questions

GET http://wuciyuan.cc/questions/images/avatars/default.jpg 404 (Not Found)

a.topic {
    background-color: #eff6fa;
    padding: 1px 10px 0;
    border-radius: 30px;
    text-decoration: none;
    margin: 0 5px 5px 0;
    display: inline-block;
    white-space: normal;
    cursor: pointer;
    float: right;
}

.panel-body img {
    width:100%;
}

a.topic {
    background-color: #eff6fa;
    padding: 1px 10px 0;
    border-radius: 30px;
    text-decoration: none;
    margin: 0 5px 5px 0;
    display: inline-block;
    white-space: normal;
    cursor: pointer;
}

a.topic:hover {
    background: #259;
    color: #fff;
    text-decoration: none;
}


.button.is-naked{
background: 0 0;
border: none;
border-radius: 0;
padding: 0;
height: auto;
}
.actions{
display: flex;
padding: 10px 20px;
}
.delete-form{
margin-left: 20px;
}
.delete-button{
color: #3097D1;
text-decoration: none;
}

这就尴尬了,大意了。看了好久就是没有看到这个, return 写成了 require 。谢谢


class Math
{

    public static function add(...$num)
    {
        require array_sum($num);
    }
}

echo Math::add(1,2,3);

抛出了如下的错误


PHP Warning:  require(6): failed to open stream: No such file or directory in /Users/cocoalee/PhpstormProjects/php-oop/Math.php on line 14

Warning: require(6): failed to open stream: No such file or directory in /Users/cocoalee/PhpstormProjects/php-oop/Math.php on line 14
PHP Fatal error:  require(): Failed opening required '6' (include_path='.:') in /Users/cocoalee/PhpstormProjects/php-oop/Math.php on line 14

Fatal error: require(): Failed opening required '6' (include_path='.:') in /Users/cocoalee/PhpstormProjects/php-oop/Math.php on line 14