cakephp - How to load a xml file in plugins webroot -
i using cakephp-3.0
in component of plugin, want load xml file in plugins webroot.
simplexml_load_file('rangemessage.xml')
the file can't found. debugging path
debug(realpath(''));
says, actual directory /path/to/app/webroot
. xml-file in /path/to/app/plugins/myplugin/webroot
how can find file without using absolute path?
you can use plugin::path()
retrieve absolute path plugin, don't have hardcode it.
plugin::path('yourplugin') . 'webroot' . ds . 'rangemessage.xml'
Comments
Post a Comment