Questions tagged «filesystem»

4
文件系统最佳实践
我正在开发一些需要从文件系统读取文件的Magento 2扩展程序。 当使用ECGM2标准运行php嗅探器时,它抱怨我正在使用类似basename或的功能dirname。 禁止使用函数dirname() 要么 禁止使用函数basename() 我应该使用哪种包装代替那些包装以获得相同的效果? [编辑] 这是一些代码,但与问题无关。 我有一个扩展\Magento\Framework\Data\Collection\Filesystem类的集合类,我想在网格(ui组件)中列出此集合,并且网格中的动作之一是下载动作。 为此,我需要获取文件的实际名称,以便将其发送到下载操作。 // here $file is dynamic and it can be // folder/filename.xml or folder/subfolder/file.tar.gz //so there is no strict number of folders and subfolders. $file = $downloader->getRelativePath($packageName); $relativeFile = UmcFilesystem::VAR_DIR_NAME . '/' .$file; $absoluteFile = $rootDir->getAbsolutePath($relativeFile); if ($rootDir->isFile($relativeFile) && $rootDir->isReadable($relativeFile)){ …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.