【发布时间】:2019-09-26 08:53:04
【问题描述】:
我得到了这个:
> The exit status code '1' says something went wrong:
stderr: "'C:\Program' is not recognized as an internal command
or external, an executable program or a batch file."
我在laravel下使用wkhtmltopdf生成pdf,效果很好。我将 windows 用于本地项目。现在,当我尝试生成它时,我收到了这个错误。没有任何变化,laravel 更新了,只是我不小心删除了我的 .env 文件。 我创建了一个新页面,但要么我的所有项目都得到一个完全空白的页面,要么在我执行 ajax 请求以生成 pdf 时出现此错误。
我在 .env 中尝试(通过 phpdotenv 3):
WKHTMLTOPDF='"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf"'
配置/snappy.php:
<?php
return array(
'pdf' => array(
'enabled' => true,
'binary' => env('WKHTMLTOPDF'),
'timeout' => false,
'options' => array(),
'env' => array(),
),
'image' => array(
'enabled' => true,
'binary' => env('WKHTMLTOIMAGE'),
'timeout' => false,
'options' => array(),
'env' => array(),
),
'binary' => env('WKHTMLTOPDF'),
);
【问题讨论】:
-
你能把你的
config/snappy.php文件代码贴在这里吗? -
'"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf"'或"\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf\"",见php.net/manual/en/language.types.string.php -
config/snappy.php 添加。这是我多次编辑后的最后一个版本
-
@JosefZ yes ` '"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf"' ` 当我放入 snappy.php 时有效。但是,如果我想放入 .env 最好的语法是什么?
标签: windows laravel laravel-5 environment-variables wkhtmltopdf