【问题标题】:Laravel excel Check image name with space not workingLaravel excel检查带有空格的图像名称不起作用
【发布时间】:2014-11-25 23:58:10
【问题描述】:

对不起, 我使用刀片使用 laravel excel,并且单元格上有图像.. 我做文件存在检查..像这样:

        <?php if (file_exists('assets/images/upload/' . $row->photo)) { ?>
            <td width="50" margin="0"><img src="assets/images/upload/{{$row->photo}}" width="50"/></td>
        <?php } else { ?>
            <td></td>
        <?php } ?>

我尝试调试该 file_exist() 方法并返回 true.. 但是当我尝试生成该报告时,Laravel excel 会生成此错误:

File assets/images/upload/my%20working%20directory.jpg not found! 

【问题讨论】:

    标签: php excel laravel laravel-excel


    【解决方案1】:

    终于成功了:

    <?php $image_url = str_replace(' ', '%20', $row->photo);
    if (file_exists('assets/images/upload/' . $image_url)) { ?>
        <td width="50" margin="0"><img src="assets/images/upload/{{$image_url}}" width="50"/></td>
    <?php } else { ?>
        <td></td>
    <?php } ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-16
      • 2013-12-07
      • 2015-04-03
      • 2012-10-04
      • 1970-01-01
      • 2011-05-30
      • 2019-10-31
      • 2020-02-07
      相关资源
      最近更新 更多