Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
barryvdh/laravel dompdf:-fopen无法打开流:laravel 5.7中没有此类文件或目录_Laravel_Dompdf_Invoice - Fatal编程技术网

barryvdh/laravel dompdf:-fopen无法打开流:laravel 5.7中没有此类文件或目录

barryvdh/laravel dompdf:-fopen无法打开流:laravel 5.7中没有此类文件或目录,laravel,dompdf,invoice,Laravel,Dompdf,Invoice,当我想下载invoice.pdf时,出现错误:- fopen(项目路径\存储\字体/\071DD89A9CB147BF5639344CAEE3FE8.ufm):无法打开流:没有这样的文件或目录 创建存储下的字体文件夹后,也出现错误: “执行时间上限”最长执行时间为30秒 我现在该怎么办 经过一路测试,我得到了一个完美的解决方案,用于“fopen faild”和“execution time expired” *execution times up" maximum execution tim

当我想下载invoice.pdf时,出现错误:-

fopen(项目路径\存储\字体/\071DD89A9CB147BF5639344CAEE3FE8.ufm):无法打开流:没有这样的文件或目录

创建存储下的字体文件夹后,也出现错误:

“执行时间上限”最长执行时间为30秒


我现在该怎么办

经过一路测试,我得到了一个完美的解决方案,用于“fopen faild”和“execution time expired”

*execution times up" maximum execution time is 30 sec.* Need to change php configuration in `php.ini` file

You should change the following configuration:

***max_execution_time = 30;
max_input_time = 60 ; 
memory_limit = 8M;   ***
当您在扩展主文件时使用发票代码时会发生这种情况,如

@extends('admin.master')
@section('body')
/* your invoice code*/
@sectionend
为了避免所有问题,只需在下载发票刀片中粘贴发票的源代码,如

<!doctype html>

    <html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>BigStore: Shopping Invoice</title>
    </head>
    <body>


    <style>
    /*css*/
    </style>
    <br>
    /**html code**/
     </body>
    </html>

大商店:购物发票
/*css*/

/**html代码**/
在Laravel 5.7中,我按照以下链接安装了dompdf:

完成安装后,我在控制器中使用此代码制作下载发票

public function downloadOrderInvoice($id) {
        $order          = Order::find($id);
        $customer       = Customer::find($order->customer_id);
        $shipping       = Shipping::find($order->shipping_id);
        $orderDetails   = OrderDetail::where('order_id', $order->id)->get();

        $pdf = PDF::loadView('admin.order.download-invoice',[
            'order'=> $order,
            'customer'=>$customer,
            'shipping'=>$shipping,
            'orderDetails'=>$orderDetails
        ]);

        return $pdf->download('invoice.pdf');
//        return $pdf->stream('invoice.pdf');
    }
在blade文件中,我只粘贴发票的所有源代码:

<!doctype html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>BigStore: Shopping Invoice</title>
</head>
<body>


    <style>
        /* reset */

        /***/
        /*{*/
        /*border: 0;*/
        /*box-sizing: content-box;*/
        /*color: inherit;*/
        /*font-family: inherit;*/
        /*font-size: inherit;*/
        /*font-style: inherit;*/
        /*font-weight: inherit;*/
        /*line-height: inherit;*/
        /*list-style: none;*/
        /*margin: 0;*/
        /*padding: 0;*/
        /*text-decoration: none;*/
        /*vertical-align: top;*/
        /*}*/

        /* content editable */

        *[contenteditable] { border-radius: 0.25em; min-width: 1em; outline: 0; }

        *[contenteditable] { cursor: pointer; }

        *[contenteditable]:hover, *[contenteditable]:focus, td:hover *[contenteditable], td:focus *[contenteditable], img.hover { background: #DEF; box-shadow: 0 0 1em 0.5em #DEF; }

        span[contenteditable] { display: inline-block; }

        /* heading */

        h1 { font: bold 100% sans-serif; letter-spacing: 0.5em; text-align: center; text-transform: uppercase; }

        /* table */

        table { font-size: 75%; table-layout: fixed; width: 100%; }
        table { border-collapse: separate; border-spacing: 2px; }
        th, td { border-width: 1px; padding: 0.5em; position: relative; text-align: left; }
        th, td { border-radius: 0.25em; border-style: solid; }
        th { background: #EEE; border-color: #BBB; }
        td { border-color: #DDD; }

        /* page */

        /*html { font: 16px/1 'Open Sans', sans-serif; overflow: auto; padding: 0.5in; }*/
        /*html { background: #999; cursor: default; }*/

        /*body { box-sizing: border-box; height: 11in; margin: 0 auto; overflow: hidden; padding: 0.5in; width: 8.5in; }*/
        /*body { background: #FFF; border-radius: 1px; box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5); }*/

        /* header */

        header { margin: 0 0 3em; }
        header:after { clear: both; content: ""; display: table; }

        header h1 { background: #000; border-radius: 0.25em; color: #FFF; margin: 0 0 1em; padding: 0.5em 0; }
        header address { float: left; font-size: 75%; font-style: normal; line-height: 1.25; margin: 0 1em 1em 0; }
        header address p { margin: 0 0 0.25em; }
        header span, header img { display: block; float: right; }
        header span { margin: 0 0 1em 1em; max-height: 25%; max-width: 60%; position: relative; }
        header img { max-height: 100%; max-width: 100%; }
        header input { cursor: pointer; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; height: 100%; left: 0; opacity: 0; position: absolute; top: 0; width: 100%; }

        /* article */

        article, article address, table.meta, table.inventory { margin: 0 0 3em; }
        article:after { clear: both; content: ""; display: table; }
        article h1 { clip: rect(0 0 0 0); position: absolute; }

        article address { float: left; font-size: 125%; font-weight: bold; }

        /* table meta & balance */

        table.meta, table.balance { float: right; width: 36%; }
        table.meta:after, table.balance:after { clear: both; content: ""; display: table; }

        /* table meta */

        table.meta th { width: 40%; }
        table.meta td { width: 60%; }

        /* table items */

        table.inventory { clear: both; width: 100%; }
        table.inventory th { font-weight: bold; text-align: center; }

        table.inventory td:nth-child(1) { width: 26%; }
        table.inventory td:nth-child(2) { width: 38%; }
        table.inventory td:nth-child(3) { text-align: right; width: 12%; }
        table.inventory td:nth-child(4) { text-align: right; width: 12%; }
        table.inventory td:nth-child(5) { text-align: right; width: 12%; }

        /* table balance */

        table.balance th, table.balance td { width: 50%; }
        table.balance td { text-align: right; }

        /* aside */

        aside h1 { border: none; border-width: 0 0 1px; margin: 0 0 1em; }
        aside h1 { border-color: #999; border-bottom-style: solid; }

        /* javascript */

        .add, .cut
        {
            border-width: 1px;
            display: block;
            font-size: .8rem;
            padding: 0.25em 0.5em;
            float: left;
            text-align: center;
            width: 0.6em;
        }

        .add, .cut
        {
            background: #9AF;
            box-shadow: 0 1px 2px rgba(0,0,0,0.2);
            background-image: -moz-linear-gradient(#00ADEE 5%, #0078A5 100%);
            background-image: -webkit-linear-gradient(#00ADEE 5%, #0078A5 100%);
            border-radius: 0.5em;
            border-color: #0076A3;
            color: #FFF;
            cursor: pointer;
            font-weight: bold;
            text-shadow: 0 -1px 2px rgba(0,0,0,0.333);
        }

        .add { margin: -2.5em 0 0; }

        .add:hover { background: #00ADEE; }

        .cut { opacity: 0; position: absolute; top: 0; left: -1.5em; }
        .cut { -webkit-transition: opacity 100ms ease-in; }

        tr:hover .cut { opacity: 1; }

    </style>


    <br/>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    <header>
                        <h1>Invoice</h1>
                        <h4>Shipping Info</h4>
                        <address>
                            <p>{{ $shipping->full_name }}</p>
                            <p>{{ $shipping->address }}</p>
                            <p>{{ $shipping->phone_number }}</p>
                        </address>
                        <h4>Billing Info</h4>
                        <address>
                            <p>{{ $customer->first_name.' '.$customer->last_name }}</p>
                            <p>{{ $customer->address }}</p>
                            <p>{{ $customer->phone_number }}</p>
                        </address>
                        <span><img alt="" src="http://www.jonathantneal.com/examples/invoice/logo.png"><input type="file" accept="image/*"></span>
                    </header>
                    <article>
                        <h1>Recipient</h1>
                        <address>
                            <p>Some Company<br>c/o Some Guy</p>
                        </address>
                        <table class="meta">
                            <tr>
                                <th><span>Invoice #</span></th>
                                <td><span>0000{{ $order->id }}</span></td>
                            </tr>
                            <tr>
                                <th><span>Date</span></th>
                                <td><span>{{ $order->created_at }}</span></td>
                            </tr>
                            <tr>
                                <th><span contenteditable>Amount Due</span></th>
                                <td><span id="prefix" contenteditable>TK.</span><span>{{ $order->order_total }}</span></td>
                            </tr>
                        </table>
                        <table class="inventory">
                            <thead>
                            <tr>
                                <th><span>Item</span></th>
                                <th><span>Description</span></th>
                                <th><span>Rate</span></th>
                                <th><span>Quantity</span></th>
                                <th><span>Total Price</span></th>
                            </tr>
                            </thead>
                            <tbody>
                            @php($sum=0)
                            @foreach($orderDetails as $orderDetail)
                                <tr>
                                    <td><span>{{ $orderDetail->product_name }}</span></td>
                                    <td><span>Experience Review</span></td>
                                    <td><span data-prefix>TK </span><span>{{ $orderDetail->product_price }}</span></td>
                                    <td><span>{{ $orderDetail->product_quantity }}</span></td>
                                    <td><span data-prefix>TK</span><span>{{ $total = $orderDetail->product_price*$orderDetail->product_quantity }}</span></td>
                                </tr>
                                @php($sum = $sum + $total)
                            @endforeach
                            </tbody>
                        </table>
                        <table class="balance">
                            <tr>
                                <th><span>Total</span></th>
                                <td><span data-prefix>TK. </span><span>{{ $sum }}</span></td>
                            </tr>
                        </table>
                    </article>
                    <aside>
                        <h1><span>Additional Notes</span></h1>
                        <div>
                            <p>A finance charge of 1.5% will be made on unpaid balances after 30 days.</p>
                        </div>
                    </aside>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

大商店:购物发票
/*重置*/
/***/
/*{*/
/*边界:0*/
/*框大小:内容框*/
/*颜色:继承*/
/*字体家族:继承*/
/*字体大小:继承*/
/*字体风格:继承*/
/*字体大小:继承*/
/*行高:继承*/
/*列表样式:无*/
/*保证金:0*/
/*填充:0*/
/*文字装饰:无*/
/*垂直对齐:顶部*/
/*}*/
/*内容可编辑*/
*[内容可编辑]{边框半径:0.25em;最小宽度:1em;轮廓:0;}
*[contenteditable]{光标:指针;}
*[contenteditable]:hover,*[contenteditable]:focus,td:hover*[contenteditable],td:focus*[contenteditable],img.hover{背景:#定义;框阴影:0 0 0 1em 0.5em#定义;}
span[contenteditable]{显示:内联块;}
/*标题*/
h1{字体:粗体100%无衬线;字母间距:0.5em;文本对齐:居中;文本转换:大写;}
/*桌子*/
表{字体大小:75%;表布局:固定;宽度:100%;}
表{边框折叠:分隔;边框间距:2px;}
th,td{边框宽度:1px;填充:0.5em;位置:相对;文本对齐:左;}
th,td{边框半径:0.25em;边框样式:实心;}
th{背景:#EEE;边框颜色:#BBB;}
td{边框颜色:#DDD;}
/*页面*/
/*html{font:16px/1'开放式Sans',无衬线;溢出:自动;填充:0.5in;}*/
/*html{background:#999;cursor:default;}*/
/*正文{框大小:边框框;高度:11英寸;边距:0自动;溢出:隐藏;填充:0.5英寸;宽度:8.5英寸;}*/
/*主体{背景:#FFF;边框半径:1px;方框阴影:0.01英寸-0.25英寸rgba(0,0,0,0.5);}*/
/*标题*/
标题{边距:0 0 3em;}
标题:{清除:两者;内容:'';显示:表;}之后
标题h1{背景:#000;边框半径:0.25em;颜色:#FFF;边距:0.01em;填充:0.5em 0;}
页眉地址{float:left;字体大小:75%;字体样式:normal;行高:1.25;边距:0 1em 1em 0;}
头地址p{margin:0.25em;}
标题范围,标题img{display:block;float:right;}
标题跨距{边距:0 0 1米1米;最大高度:25%;最大宽度:60%;位置:相对;}
收割台img{最大高度:100%;最大宽度:100%;}
标题输入{cursor:pointer;-ms过滤器:“progid:DXImageTransform.Microsoft.Alpha(不透明度=0)”;高度:100%;左侧:0;不透明度:0;位置:绝对;顶部:0;宽度:100%;}
/*文章*/
文章,文章地址,table.meta,table.inventory{margin:0 0 3em;}
文章:{清除:两者;内容:'';显示:表;}
第h1条{剪辑:rect(0);位置:绝对;}
文章地址{float:左;字体大小:125%;字体大小:粗体;}
/*表元与平衡*/
table.meta,table.balance{float:右;宽度:36%;}
table.meta:after,table.balance:after{clear:both;content:;;display:table;}
/*表元*/
table.meta th{宽度:40%;}
table.meta td{宽度:60%;}
/*表项*/
table.inventory{清除:两个;宽度:100%;}
table.th{字体重量:粗体;文本对齐:居中;}
表1.1:第n个子项(1){宽度:26%;}
表1.1:第n个子项(2){宽度:38%;}
table.inventory td:n子级(3){文本对齐:右;宽度:12%;}
table.inventory td:n子项(4){文本对齐:右;宽度:12%;}
table.inventory td:n子项(5){文本对齐:右;宽度:12%;}
/*天平*/
table.balance th,table.balance td{宽度:50%;}
table.balance td{text align:right;}
/*旁白*/
h1{边框:无;边框宽度:0 0 1px;边距:0 0 1em;}
h1{边框颜色:#999;边框底部样式:纯色;}
/*javascript*/
.添加,.剪切
{
边框宽度:1px;
显示:块;
字体大小:.8rem;
填充:0.25em 0.5em;
浮动:左;
文本对齐:居中;
宽度:0.6em;
}
.添加,.剪切
{
背景:9AF;
盒影:0 1px2pRGBA(0,0,0,0.2);
背景图像:-莫兹线性梯度(#00ADEE 5%,#0078A5 100%);
背景图片:-webkit线性渐变(#00ADEE 5%,#0078A5 100%);
边界半径:0.5em;
边框颜色:#0076A3;
颜色:#FFF;
光标:指针;
字体大小:粗体;
文本阴影:0-1px2pRGBA(0,0,0,0.333);
}
添加{边距:-2.5em 0;}
.add:悬停{
php artisan vendor:publish