use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\Folder; use OCP\Files\File; use OCP\Files\FileInfo; $rootFolder = \OC\Files\Filesystem::getRoot(); $fileInfo = $rootFolder->createFile("example.txt"); $file = $fileInfo->getStorage()->getCache()->get($fileInfo->getId());
use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\Folder; use OCP\Files\File; use OCP\Files\FileInfo; $rootFolder = \OC\Files\Filesystem::getRoot(); $fileInfo = $rootFolder->get("example.txt"); $file = $fileInfo->getStorage()->getCache()->get($fileInfo->getId()); $content = $file->getContent();
use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\Folder; use OCP\Files\File; use OCP\Files\FileInfo; $rootFolder = \OC\Files\Filesystem::getRoot(); $fileInfo = $rootFolder->get("example.txt"); $file = $fileInfo->getStorage()->getCache()->get($fileInfo->getId()); $file->delete();This code deletes the "example.txt" file from the server filesystem. Overall, the php oc.files Filesystem package library makes it easy to interact with the server filesystem in a safe and efficient manner.