简体   繁体   中英

Laravel Return value is expected to be 'illuminate\Http\Response', 'string' returned

Hi have this function which is returning path of a file.

public function filecreate()
{
    $myHelper = new MyHelper();
    $path = $myHelper->create();

    return $path;
}

phpStorm showing warning of

Return value is expected to be 'illuminate\\Http\\Response', 'string' returned

您必须使用Response对象作为回报,并使用helper:

return response(%path_to_view);

The response() helper may be used to generate other types of response instances. source

To return simple string use:

return response($path)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM