Unable to load library LIBRARY_NAME
Seme framework has supported library directory under kero/lib
, so you have to checked it for supplied library name or path with its library name are exist.
Example error message
could not find model b_user_model on D:/XAMPP/htdocs/seme_framework/app/model/b_user_model.php
could not find model api/b_user_model on D:/XAMPP/htdocs/seme_framework/app/model/api/b_user_model.php
could not find model admin/b_user_model on D:/XAMPP/htdocs/seme_framework/app/model/admin/b_user_model.php
Solution
Check the library are existed on kero/lib/
.
Please make sure the filename and with its extension are not contain symbol and whitespace(s).
Example PHPOffice/Spreadsheet library loader
Some library cannot be loaded by Seme Framework library loader, you have to included it manually using its namespace.
<?php
//loading library
$vendorDirPath = (SEMEROOT.'kero/lib/phpoffice/vendor/');
$vendorDirPath = realpath($vendorDirPath);
require_once $vendorDirPath.'/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class Home extends SENE_Controller
{
public function __construct()
{
parent::__construct();
....
}
public function download_xls($){
$objPHPExcel = new Spreadsheet();
$objWorkSheet = $objPHPExcel->setActiveSheetIndex(0);
$objWorkSheet->setTitle("Example");
$objWorkSheet->setCellValue('A1', 'Example')->mergeCells('A1:G1');
$filename = 'example.xlsx';
$objWriter = new Xlsx($objPHPExcel);
$objWriter->save(filename);
//force download
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($filename));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
ob_clean();
flush();
readfile($pathFile);
exit;
}
}