尝试在 Laravel 中读取 barryvh/dompdf 时无法解析公共路径
我将 Laravel 应用程序部署到共享托管。然后,我将文件夹分为两个 DOMAIN(包含所有其他文件夹)和 public_html(包含公共目录中的文件)。然后我像这样公开修改了index.php文件
require __DIR__.'/../domain/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../domain/bootstrap/app.php';
该应用程序似乎运行良好,除了一些功能(例如barrydompdf)给我带来了错误 无法解析公共路径 请知道我该如何解决这个问题。预先感谢大家。
I deployed a laravel app to shared hosting. Then I separated the folders into two DOMAIN containing the all the other folders and public_html containing the files in the public directory. I then modified index.php file in public like this
require __DIR__.'/../domain/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../domain/bootstrap/app.php';
The app seems to work well, except for some features like the barrydompdf that gives me the error
Cannot resolve public path
Please any idea on how I can fix this. Thank you all in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是 DOMPDF 最愚蠢的错误。
要解决这个错误,你需要做的就是在项目目录中创建一个public文件夹,虽然它没有什么用。
This is the most stupid error by DOMPDF.
To resolve this error, all you need to do is to create a public folder in project directory, Although it is of no use.
remplace
到
文件路径
/config/dompdf.php
您可以在这里看到相同的主题
remplace
for
to file path
/config/dompdf.php
you can see the same topic here
这个问题已经提交到 DOMPDF Git 并且人们已经找到了它的解决方法。
走这条路
编辑
搜索
并将其替换为
或者您可以在您的代码库目录中创建一个公共文件夹
编辑:
当您的代码库没有公用文件夹并且您已将公用文件夹分离到 public_html 时,就会发生这种情况。
This issue is submitted to DOMPDF Git already and people have found workaround of it.
Go to this path
Edit
Search for
and replace it with
OR YOU CAN JUST CREATE A PUBLIC FOLDER IN YOUR CODEBASE DIRECTORY
EDIT:
This happens when your code base has no public folder and you have separated your public folder to public_html.
切勿编辑供应商文件夹下的内容
只需在 config/app.php 中添加此属性
Never edit the content under the vendor folder
Just add this property in your config/app.php
解决方案只是在项目的根目录中创建 public 文件夹,因为当您尝试从供应商文件夹更改 dompdf 包的公共路径时,如果您更新 Composer,它会自动将 public_html 目录更改为 publi
The solution is simply to create public folder in root of your project because when you try to change the public path of dompdf package from the vendor folder and after that if you update the composer it will automatically change the public_html directory to publi
我在解决这个问题时遇到了同样的问题。我删除了文件夹供应商:
然后我再次安装库:
现在它工作正常。
I had the same problem with resolving this. I removed the folder vendor:
and then I install the libraries again with:
With this now it is working fine.