XMLWriter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: XMLWriter (/showthread.php?tid=78478) |
XMLWriter - g3ck0 - 01-26-2021 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(); RE: XMLWriter - iRedds - 01-26-2021 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(); RE: XMLWriter - g3ck0 - 01-27-2021 (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. 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. RE: XMLWriter - nfaiz - 01-27-2021 (01-27-2021, 12:06 AM)g3ck0 Wrote:try(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. PHP Code: $xml = new \XMLWriter(); RE: XMLWriter - iRedds - 01-27-2021 (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. RE: XMLWriter - g3ck0 - 01-27-2021 thank you for both of you, and thank you for your time helping me |