How can I delete a file that resides in a child folder of Codeigniter's /application/
folder (eg /application/schematics/myfile.png
) from within a model?
I also have the path to the file like schematics/myfile.png
.
您应该尝试这样做, APPPATH
给出了到application
文件夹的路径:
$path = APPPATH.'/schematics/myfile.png';
I recommend to create resources folders out of application folder. Because if you use htaccess, all that you put in url is redirected how param to index.php that it will redirect to right controller.
I use it this way:
In the index.php file in the root, most useful paths are defined so that you can use them within the rest of the code.
FCPATH -> '/'
BASEPATH -> '/system/'
APPPATH -> '/application/'
Or maybe try
$path = $_SERVER['DOCUMENT_ROOT'].'/application/schematics/myfile.png';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.