我找到了这个symfony组件The Filesystem,但我不确定我是否应该使用这个组件或本机PHP.示例mkdir:
// With symfony:
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
$fs = new Filesystem();
$fs->mkdir('/tmp/photos', 0700);
// Native PHP:
mkdir('/tmp/photos', 0700);
Run Code Online (Sandbox Code Playgroud)
同样使用$fs->exists()的替代file_exists()或$fs->touch()代替touch().然后有$fs->copy()支持第三个参数(bool)来切换覆盖现有文件,而native copy()将始终覆盖目标文件.
我根本不使用symfony,只使用了很少的供应商,而且我找到了它.我的意思是,我为什么要使用这个组件?在我看来,本身功能与额外的步骤.您的建议有助于了解我是否应该在将来使用这样的组件.
interfaces与发动机交换(通过电源)与亚马逊,保管箱或其他一些外部驱动器.这是我的观点.和#3是最大的力量在我看来.
如果您今天正在使用本地驱动器,并且您正在执行此操作file_exists,那么它将起作用.但明天你的老板会说"从现在起我们就是CDNing文件. You'll have to go into the code and change allfile_exists methods withs3_file_exists`.
一旦你使用Symfony的课程,你所要做的就是用以下的方式交换它:\Amazon\Custom\Package\FileSystem你很高兴去!