We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

unlink files

So i have a Multi Module Apllication , and i want to delete a file , currently i have the following :

unlink("{$_SERVER['DOCUMENT_ROOT']}/public/assets/frontend/images/agendas/{$agenda->image}")

Is there a more affective way ?



98.9k

what do you mean by affective?

what do you mean by affective?

Like not using $_SERVER , i want somthing like : /assets/frontend/images/

Hello,

I'm using :

unlink("img/" . $image->filename);

That works fine.

The current folder is 'public' (where is located the index.php).

So for you it's could be

unlink("assets/frontend/images/agendas/{$agenda->image}");

Hello. What about using: APP_PATH

unlink(APP_PATH."/public/assets/frontend/images/agendas/{$agenda->image}")