[TOC] > [github](https://github.com/dflydev/dflydev-canal) ## 安装 `composer require dflydev/canal` ## demo ``` $analyzer = new Dflydev\Canal\Analyzer\Analyzer; $internetMediaType = $analyzer->detectFromFilename('png_1.png'); //文件后缀来判断是什么媒体类型 echo $internetMediaType->asString().PHP_EOL;//image/jpeg echo $internetMediaType->getType().PHP_EOL; //image echo $internetMediaType->getSubtype().PHP_EOL;//jpeg ```