Rumah  >  Artikel  >  pembangunan bahagian belakang  >  为什么PHPWord的源代码中没有vendor的文件夹?

为什么PHPWord的源代码中没有vendor的文件夹?

WBOY
WBOYasal
2016-08-18 09:15:572179semak imbas

在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的方法是在 .gitignore 增加这个目录.

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn