每天laravel-20160910|Filesystem-1
2016-07-11 11:12
405 查看
namespace Illuminate\Filesystem; use ErrorException; use FilesystemIterator; use Symfony\Component\Finder\Finder; use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Filesystem\FileNotFoundException; // long time ago ,never see namespace so better, now I will use it more class Filesystem { use Macroable;// this is a trait class like a real class /** * Determine if a file or directory exists. * * @param string $path * @return bool */ public function exists($path) { return file_exists($path);// a method wrap }// Determine if a file or directory exists. /** * Get the contents of a file. * * @param string $path * @return string * * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function get($path) { if ($this->isFile($path)) {// Determine is a file return file_get_contents($path);//get file contents } throw new FileNotFoundException("File does not exist at path {$path}"); }// get file contents
本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1825269
相关文章推荐
- [李景山php]每天laravel-20160910|Filesystem-1
- 修改PHP 上传文件大小限制
- 基于RTP的H264视频数据打包解包类
- PHP针对字符串开头和结尾的判断方法
- RTP包里面得到H.264数据和AAC数据的方法
- PHP 处理2038后的日期
- mac下无法访问本地项目的错误分析
- php进行ip地址掩码运算处理的方法
- PHP MYSQL 数据库结构同步脚本
- php curl发送json格式数据并获取状态码 header和body
- php解析xml 的四种简单方法(附实例)
- php冒泡排序
- [高通]8X16的TP笔记
- php进程间通讯实例分析
- PHP的openssl加密扩展使用小结
- phpexcel 导出 基本设置
- FTP和FXP的区别
- 关于上传图片失败的问题
- php通过两层过滤获取留言内容的方法
- php基于openssl的rsa加密解密示例