PHP 目錄名() 函數

| | | |
dirname() 函數返回父目錄的路徑,其中包含句點 (`.`),除非路徑中包含指示當前目錄的正斜杠。語法:
string dirname ($ path)
參數:PHP中的dirname()函數只有一個參數,即$path。該參數指定要檢查的路徑。返回值:返回父目錄的路徑。錯誤與異常
  • 指定路徑時,正斜杠,正向斜杠 (/) 和反斜杠 (/) 在 Windows 環境中用作目錄分隔符,而在其他環境中它只是正斜杠 (/)。
  • dirname() 函數對輸入字符串進行操作因此不知道實際的文件系統或路徑組件,例如“..”。
  • 示例:
    輸入:dirname ("user01 /engineerforengineer/gfg.txt") 輸出: user01 /engineerforengineer 輸入:dirname("/engineerforengineer/gfg.txt");輸出:/engineerforengineer
    下面的程序說明了 dirname() 函數:Program 1 :
    //指定函數dirname()的路徑echo dirname( " user01 /engineerforengineer/gfg.txt " )
    ?>
    輸出:
    user01/engineerforengineer
    程序 2 :
    //指定dirname()函數的路徑echo dirname( " /engineerforengineer/gfg.txt " );
    ?>
    輸出:
    /engineerforengineer 
    鏈接:
    http://php.net/manual /en/function.dirname.php

    Shop

    Learn programming in R: courses

    $

    Best Python online courses for 2022

    $

    Best laptop for Fortnite

    $

    Best laptop for Excel

    $

    Best laptop for Solidworks

    $

    Best laptop for Roblox

    $

    Best computer for crypto mining

    $

    Best laptop for Sims 4

    $

    Latest questions

    NUMPYNUMPY

    psycopg2: insert multiple rows with one query

    12 answers

    NUMPYNUMPY

    How to convert Nonetype to int or string?

    12 answers

    NUMPYNUMPY

    How to specify multiple return types using type-hints

    12 answers

    NUMPYNUMPY

    Javascript Error: IPython is not defined in JupyterLab

    12 answers


    Wiki

    Python OpenCV | cv2.putText () method

    numpy.arctan2 () in Python

    Python | os.path.realpath () method

    Python OpenCV | cv2.circle () method

    Python OpenCV cv2.cvtColor () method

    Python - Move item to the end of the list

    time.perf_counter () function in Python

    Check if one list is a subset of another in Python

    Python os.path.join () method