文件在Laravel中无法读取

Im trying to open a template with PHPExcel, in laravel.

$objPHPExcel = PHPExcel_IOFactory::load(URL::to_asset('myfile.xls'));

However, I get a File is not readable error.

When I do this...

if(is_readable(URL::to_asset('myfile.xls')){
    echo "is readable";
 } else { echo "nope";}

I get "nope" returned to me.

If i echo an image from this same asset directory, it displays fine.

<img src='URL::to_asset('img/test.png')'>

However if i do this....it also return "nope"

if(is_readable(URL::to_asset(img/test.png')){
    echo "is readable";
 } else { echo "nope";}

What is going on here?

Why if I visit the link in my browser the files display fine.

yet when I test them for readbility, they return false results??

This is Larave 3

Thanks

The PHP function is_readable() expects a system file as argument, so does PHPExcel_IOFactory::load(); you are passing a URL instead, which will always fail.

You need the local system path to the file and use that instead.