현재 위치: > 함수 카테고리 모음> basename

basename

경로에서 파일 이름 부분을 반환합니다
이름:basename
분류:파일 시스템
사용 언어:php
한 줄 설명:경로에서 파일 이름 부분을 반환합니다.

 <span class="token php language-php"><span class="token delimiter important"><? php</span>
<span class="token variable">$ path</span> <span class="token operator">=</span> <span class="token string double-quoted-string">"/testweb/home.php"</span> <span class="token punctuation">;</span>

<span class="token comment">// 파일 확장자가있는 파일 이름을 표시합니다</span>
<span class="token keyword">echo</span> <span class="token function">basename</span> <span class="token punctuation">(</span> <span class="token variable">$ path</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>

<span class="token comment">// 파일 확장없이 파일 이름을 표시합니다</span>
<span class="token keyword">echo</span> <span class="token function">basename</span> <span class="token punctuation">(</span> <span class="token variable">$ path</span> <span class="token punctuation">,</span> <span class="token string double-quoted-string">".php"</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

산출:

 home.php
집
유사한 함수
  • 파일의 inode 수정 시간을 가져옵니다 filectime

    filectime

    파일의inode수정시간을가져옵니다
  • disk_free_space의 별칭 diskfreespace

    diskfreespace

    disk_free_space의별칭
  • 버퍼링 된 컨텐츠를 파일로 내 보냅니다 fflush

    fflush

    버퍼링된컨텐츠를파일로내보냅니다
  • is_writable 별칭 is_writeable

    is_writeable

    is_writable별칭
  • 열린 파일 포인터를 닫습니다 fclose

    fclose

    열린파일포인터를닫습니다
  • 파일 또는 디렉토리의 이름을 바꿉니다 rename

    rename

    파일또는디렉토리의이름을바꿉니다
  • 주어진 파일 이름이 실행 가능한지 확인하십시오 is_executable

    is_executable

    주어진파일이름이실행가능한지확인하십시오
  • 파일 소유자를 변경하십시오 chown

    chown

    파일소유자를변경하십시오
인기 기사