Home >Backend Development >PHP Tutorial >yii2 error when exporting table using PHPExcel
I installed PHPExcel using Composer, why am I getting this error?
Supplement:
1. The code package is installed through composer, yii2 requires a namespace, PHPExcel does not have a namespace,
2. When the PHPExcel.php file is referenced in the test file, an error is reported, " Namespace missing?",
3. I added the namespace, but at this time another error was reported, "Class 'commonextensionsPHPExcel_Calculation' not found",
4. I looked for this class and found it In the Calculation.php file, I then added the namespace to the Calculation.php file and introduced it, but I still reported this error. How to fix it,
5. I changed the name of the Calculation.php file to PHPExcel_Calculation. php, then there is the error in the picture
I installed PHPExcel using Composer, why am I getting this error?
Supplement:
1. The code package is installed through composer, yii2 requires a namespace, PHPExcel does not have a namespace,
2. When the PHPExcel.php file is referenced in the test file, an error is reported, " Namespace missing?",
3. I added the namespace, but at this time another error was reported, "Class 'commonextensionsPHPExcel_Calculation' not found",
4. I looked for this class and found it In the Calculation.php file, I then added the namespace to the Calculation.php file and introduced it, but I still reported this error. How to fix it,
5. I changed the name of the Calculation.php file to PHPExcel_Calculation. php, then there is the error in the picture
The prompt says xxx func not found
‘Your error is that the relative class was not found and the dependent class was not found’.
First confirm whether the installation is successful and check whether the code package has been downloaded
Then introduce the class mechanism in the package according to YII2 {take an example of laravel composer and after downloading it, you need to configure the cofing/app.php file}
Test it later if it still doesn’t work
Write a test php file directly to test whether it is useful
1. Go in and see if this class is there. If it is, please require the entry file of phpexcel before calling
This does not seem to be installed by composer. If it can be used directly, please check whether it is installed by composer.