簡體   English   中英

如何在NetBeans中生成.phar

[英]How to generate .phar in netbeans

我在構建php應用程序時遇到問題。

該項目中不存在目標“構建”

在netbeans php項目中。

只需發送所有使用ubuntu os在netbeans IDE中與composer一起構建phar的程序

Netbeans有插件,您可以安裝NBPhar ,它將幫助您創建.phar文件。


您可以按照以下步驟創建.phar文件:

使用以下代碼在myapp根目錄中創建一個名為create-phar.php的新PHP文件:

<?php
$srcRoot = "~/myapp/src";
$buildRoot = "~/myapp/build";

$phar = new Phar($buildRoot . "/myapp.phar", 
    FilesystemIterator::CURRENT_AS_FILEINFO |       FilesystemIterator::KEY_AS_FILENAME, "myapp.phar");
$phar["index.php"] = file_get_contents($srcRoot . "/index.php");
$phar["common.php"] = file_get_contents($srcRoot . "/common.php");
$phar->setStub($phar->createDefaultStub("index.php"));

copy($srcRoot . "/config.ini", $buildRoot . "/config.ini");

然后打開一個終端窗口,導航到myapp目錄並運行它:

$ php create-phar.php

請參閱本文使用Phar打包您的應用程序以獲取詳細說明。

暫無
暫無

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

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