What am I trying to do, is the CodeIgniter style entry model, $ this-> By calling model_name - & gt; Function () What I've done so far in my controllers:
$ this-> load = new load (); Foreign currency (globe ("app / model / * .php") as $ file) {$ model = basename ($ file, ".php"); $ This- & gt; $ Model = new $ model; } I know that whatever I am trying to do there I can not, but hopefully you can see my goal. What I want to do, write the PDP in the model folder for each file $ this-> Model name = new model name; I'm capturing all the PHP files and leaving the directory and .php and just leaving the file name.
I understand that it is difficult to understand, its difficulty & gt; & Lt;
This should really work, you really need to include the file:
foreign currency (globe ("app / model / * .php") as $ file) {@include_once $ file; $ Model = basename ($ file, ".php"); If (class_exists ($ Models)) {$ this- & gt; $ Model = new $ model; } Else {// handle error, remove an exception? }}
Comments
Post a Comment