-
g3ck0
Newbie
-
Posts: 3
Threads: 1
Joined: Jan 2021
Reputation:
0
i'm trying to use the XMLWriter from PHP in a CI4 project, but it throws this error:
Class 'App\Models\XMLWriter' not found
this project was working fine on CI2, but i'm trying to redo the whole system using CI4
this is the code where it fails:
$xml = new XMLWriter();
-
iRedds
Senior Member
-
Posts: 662
Threads: 36
Joined: Apr 2019
Reputation:
45
01-26-2021, 11:04 PM
(This post was last modified: 01-26-2021, 11:06 PM by iRedds.)
In your code implementation, the class autoloader looks for the XMLWriter class in the app/Models directory.
This class is not in the catalog, or it does not have an App\Models namespace defined.
not enough information
There is no class autoloader in CI < 4, so you couldn't load the class simply by writing $xml = new XMLWriter();
-
g3ck0
Newbie
-
Posts: 3
Threads: 1
Joined: Jan 2021
Reputation:
0
(01-26-2021, 11:04 PM)iRedds Wrote: In your code implementation, the class autoloader looks for the XMLWriter class in the app/Models directory.
This class is not in the catalog, or it does not have an App\Models namespace defined.
not enough information
There is no class autoloader in CI < 4, so you couldn't load the class simply by writing $xml = new XMLWriter();
that is the way in which i'm trying to load it, as if i was loading the PHP extension, but it is not working, i don't know why CI4 thinks that i'm trying to use a CI4's class, i already reviewed the extension in the server and it looks like that extension is enabled and running, any help/hint will be appreciated, thanks.
-
nfaiz
Member
-
Posts: 59
Threads: 10
Joined: Apr 2015
Reputation:
3
(01-27-2021, 12:06 AM)g3ck0 Wrote: (01-26-2021, 11:04 PM)iRedds Wrote: In your code implementation, the class autoloader looks for the XMLWriter class in the app/Models directory.
This class is not in the catalog, or it does not have an App\Models namespace defined.
not enough information
There is no class autoloader in CI < 4, so you couldn't load the class simply by writing $xml = new XMLWriter();
that is the way in which i'm trying to load it, as if i was loading the PHP extension, but it is not working, i don't know why CI4 thinks that i'm trying to use a CI4's class, i already reviewed the extension in the server and it looks like that extension is enabled and running, any help/hint will be appreciated, thanks. try
-
iRedds
Senior Member
-
Posts: 662
Threads: 36
Joined: Apr 2019
Reputation:
45
(01-27-2021, 12:06 AM)g3ck0 Wrote: that is the way in which i'm trying to load it, as if i was loading the PHP extension, but it is not working, i don't know why CI4 thinks that i'm trying to use a CI4's class, i already reviewed the extension in the server and it looks like that extension is enabled and running, any help/hint will be appreciated, thanks.
God. My bad.
XMLWriter is the default php class.
Use a backslash before the class name. Like \XMLWriter.
This means that the class is in the global namespace.
-
g3ck0
Newbie
-
Posts: 3
Threads: 1
Joined: Jan 2021
Reputation:
0
thank you for both of you, and thank you for your time helping me
|