首頁  >  文章  >  後端開發  >  為什麼PHPWord的原始碼中沒有vendor的資料夾?

為什麼PHPWord的原始碼中沒有vendor的資料夾?

WBOY
WBOY原創
2016-08-18 09:15:572175瀏覽

在PHPWord/bootstrap.php

<code>$vendorDirPath = realpath(__DIR__ . '/vendor');
if (file_exists($vendorDirPath . '/autoload.php')) {
    require $vendorDirPath . '/autoload.php';
} else {
    throw new Exception(
        sprintf(
            'Could not find file \'%s\'. It is generated by Composer. Use \'install --prefer-source\' or \'update --prefer-source\' Composer commands to move forward.',
            $vendorDirPath . '/autoload.php'
        )
    );
}
</code>

但在這裡:https://github.com/PHPOffice/...
並沒有看到vendor的資料夾?
這是怎麼回事?

回覆內容:

在PHPWord/bootstrap.php

<code>$vendorDirPath = realpath(__DIR__ . '/vendor');
if (file_exists($vendorDirPath . '/autoload.php')) {
    require $vendorDirPath . '/autoload.php';
} else {
    throw new Exception(
        sprintf(
            'Could not find file \'%s\'. It is generated by Composer. Use \'install --prefer-source\' or \'update --prefer-source\' Composer commands to move forward.',
            $vendorDirPath . '/autoload.php'
        )
    );
}
</code>

但在這裡:https://github.com/PHPOffice/...
並沒有看到vendor的資料夾?
這是怎麼回事?

composer install一下應該就會產生。
沒用使用composer套件管理就沒有vendor。

throw的Exception裡面已經寫的很懂了

你開發一個專案透過composer進行套件依賴管理, 然後把它開源把到github上, 但是你依賴的第三方庫是沒必要放到版本控制器中的.
只需要把composer.json文件放上去, read.me檔案中一般會說明安裝方式, 讓你運行composer install,
所以一般會把vendor忽略掉, git忽略掉vendor的方法是在這個忽略掉, git忽略掉vendor

的方法是在這個🎜.gitignore🎜.目錄.🎜
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn