meiner aktuellen Controller & Bibliothek werden folgen aufgelistet ...Zugriff auf Bibliothek in CI HMVC?
>application/
- config/
- controllers/
- ...
- models/
- modules/
- module1/
- controllers/
- Test_cont.php
- models/
- views/
- libraries
- Test_lib.php
- third_party/
- views/
- ...(other files & folders)
'modules/module1/controllers/Test_cont.php' ist:
class Test_cont extends MY_Controller
{
function __construct(){
parent::__construct();
}
function index(){
$this->load->library('Test_lib');
$this->Test_lib->doSomething();
}
}
‚modules/module1/Bibliotheken/Test_lib.php 'Datei ist:
class Test_lib
{
function __construct(){
echo 'library loaded <br>';
}
function doSomething(){
echo 'it works!';
}
}
, wenn ich an die URL gehen' http://localhost/codeigniter-3.1.3/module1/test_cont " heißt es:
---------------------------------------------------
| An Error Was Encountered |
---------------------------------------------------
| Unable to load the requested class: Test |
---------------------------------------------------
Ich hoffe, ich kann Sie mein Problem zu verstehen, wie diese zu lösen? ... (Vielen Dank im Voraus)
Try-Bibliothek wie diese '$ this-> last-> Bibliothek laden ('module1/test_lib '); 'und verwenden Sie Kleinbuchstaben-Syntax. – smokehill
@smokehill Sie müssen nur 'Modul/Bibliothek' schreiben, wenn Sie von einem anderen Modul auf die Bibliothek zugreifen wollen – lumos0815
@Amin ist Ihr Problem gelöst? – lumos0815