從thinkphp 5.1.x后vendor的使用方法發生變化,文檔又沒有詳細說明。官方真的太坑了!
在thinkPHP 5.1.X后新版取消了Loader::import方法以及import和vendor助手函數,推薦全面采用命名空間方式的類以及自動加載機制,如果必須使用請直接改為php內置的include或者require語法。
原來的import(“Vendor.Classes.PHPExcel.IOFactory”);或Vendor(‘phpoffice.phpexcel.Classes.PHPExcel.IOFactory’);方法已經不再使用。
請使用下面的方法:
thinkphp6 使用vendor中的第三方庫
require_once('/data/www/xxxxxxx/vendor/PHPExcel/PHPExcel.php');