在PHPWord/bootstrap.php
中:
$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' ) );}
但在這裡:https://github.com/PHPOffice/...
並沒有看到vendor的檔案夾?
這是怎麼回事?
回複內容:
在PHPWord/bootstrap.php
中:
$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' ) );}
但在這裡:https://github.com/PHPOffice/...
並沒有看到vendor的檔案夾?
這是怎麼回事?
composer install一下應該就會產生。
沒用使用composer包管理就沒有vendor。
throw的Exception裡面已經寫的很明白了
你開發一個項目通過composer進行包依賴管理, 然後把它開源把到github上, 但是你依賴的第三方庫是沒必要放到版本控制器中的.
只需要把composer.json檔案放上去, read.me檔案中一般會說明安裝方式, 讓你運行 composer install,
所以一般會把vendor忽略掉, git忽略掉vendor的方法是在 .gitignore 增加這個目錄.