簡體   English   中英

如何從Phar存檔訪問外部文件?

[英]How to access to external files from Phar archives?

我需要將配置文件放在我的Web應用程序的phar之外。 我需要安裝它。 在我的存根文件中,我試過:

<?php
try {
    Phar::mount('sites/site.php', __DIR__.'/../sites/site.php');
} catch (PharException $e) {
    print_r($e);
};
Phar::mapPhar();
include '../app.phar';

但是,我得到“ Mounting of sites/site.php to D:\\(...)\\public/../sites/site.php failed ”錯誤消息。 我嘗試了各種文件路徑樣式,沒有任何成功。 這有什么問題?

我使用box2來ubild phar文件。 構建phar文件需要很長時間。 有沒有辦法讓它更快?

錯誤消息也很模糊。 有什么辦法可以獲得更好的信息

您是否嘗試使用內部phar uri作為安裝點,如:

 Phar::mount('phar://sites/site.php', __DIR__.'/../sites/site.php');

此外,我不知道問題可能是由於sites subdir,你嘗試:

 Phar::mount('site.php', __DIR__.'/../sites/site.php');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM