[PHP] ファイルパスからファイルの拡張子を取得する方法
ファイルパスからファイルの拡張子を取得するには、substr関数とstrrpos関数を組み合わせる
<?php
$filePath = '/etc/nginx/conf.d/default.conf';
$extensions = substr($filePath, strrpos($filePath, '.') + 1);
echo $extensions;
ファイルパスからファイルの拡張子を取得するには、substr関数とstrrpos関数を組み合わせる
<?php
$filePath = '/etc/nginx/conf.d/default.conf';
$extensions = substr($filePath, strrpos($filePath, '.') + 1);
echo $extensions;