天天看点

php分离文件路径目录路径和文件名的方法

basename()函数用于从路径中获得文件名

dirname()函数用于从路径中获得文件目录

<?php
$full_name = 'c:\wamp\php\php.ini';
$base = basename($full_name); // $base is "php.ini"
$dir = dirname($full_name);  // $dir is "c:\wamp\php"
?>