Hướng dẫn what is php pathinfoextension? - Phần mở rộng php pathinfo là gì?

(Php 4> = 4.0.3, Php 5, Php 7, Php 8)

PathInfo - Trả về thông tin về đường dẫn tệpReturns information about a file path

Sự mô tả

pathinfo (chuỗi $path, int $flags = PATHINFO_ALL): mảng | chuỗi(string $path, int $flags = PATHINFO_ALL): array|string

Ghi chú::

Để biết thông tin về việc truy xuất thông tin đường dẫn hiện tại, hãy đọc phần về các biến được đặt trước được xác định trước.

Ghi chú::

Để biết thông tin về việc truy xuất thông tin đường dẫn hiện tại, hãy đọc phần về các biến được đặt trước được xác định trước. operates naively on the input string, and is not aware of the actual filesystem, or path components such as "..".

pathInfo () hoạt động ngây thơ trên chuỗi đầu vào và không nhận thức được hệ thống tập tin thực tế hoặc các thành phần đường dẫn như "..".

Thận trọng is locale aware, so for it to parse a path containing multibyte characters correctly, the matching locale must be set using the setlocale() function.

pathInfo () là nhận thức được ngôn ngữ, vì vậy để nó phân tích một đường dẫn chứa các ký tự multibyte một cách chính xác, locale phù hợp phải được đặt bằng hàm setLocale ().

Thông số

path

Con đường được phân tích cú pháp.

________số 8PATHINFO_DIRNAME,

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
0,
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
1
or
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
2
.

Nếu có, chỉ định một yếu tố cụ thể sẽ được trả về; một trong số PATHINFO_DIRNAME,

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
0,
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
1 hoặc
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
2.

Nếu flags không được chỉ định, hãy trả về tất cả các yếu tố có sẵn.

Trả về giá trịarray containing the following elements is returned:

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
5,
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
6,
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
7 (if any), and
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
8.

Ghi chú::

Để biết thông tin về việc truy xuất thông tin đường dẫn hiện tại, hãy đọc phần về các biến được đặt trước được xác định trước.

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
1 returns only the last one and
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
2
only strips the last one. (see first example below).

Ghi chú::

Để biết thông tin về việc truy xuất thông tin đường dẫn hiện tại, hãy đọc phần về các biến được đặt trước được xác định trước.

Ghi chú::

Để biết thông tin về việc truy xuất thông tin đường dẫn hiện tại, hãy đọc phần về các biến được đặt trước được xác định trước.

pathInfo () hoạt động ngây thơ trên chuỗi đầu vào và không nhận thức được hệ thống tập tin thực tế hoặc các thành phần đường dẫn như "..".string containing the requested element.

Thận trọng

pathInfo () là nhận thức được ngôn ngữ, vì vậy để nó phân tích một đường dẫn chứa các ký tự multibyte một cách chính xác, locale phù hợp phải được đặt bằng hàm setLocale ().pathinfo() Example

Array
(
    [dirname] => /some/path
    [basename] => .test
    [extension] => test
    [filename] => 
)
9

$path0

$path1

Thông số

/www/htdocs/inc
lib.inc.php
php
lib.inc

pathpathinfo() example showing difference between null and no extension

$path2

Con đường được phân tích cú pháp.

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL

________số 8pathinfo() example for a dot-file

$path3

Con đường được phân tích cú pháp.

Array
(
    [dirname] => /some/path
    [basename] => .test
    [extension] => test
    [filename] => 
)

________số 8

  • Nếu có, chỉ định một yếu tố cụ thể sẽ được trả về; một trong số PATHINFO_DIRNAME,
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    0,
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    1 hoặc
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    2.
  • Nếu flags không được chỉ định, hãy trả về tất cả các yếu tố có sẵn.
  • Trả về giá trị
  • Nếu tham số flags không được thông qua, một mảng kết hợp có chứa các phần tử sau được trả về:
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    5,
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    6,
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    7 (nếu có) và
    string(0) ""
    
    Notice: Undefined index: extension in test.php on line 6
    NULL
    
    8.

Nếu path có nhiều hơn một phần mở rộng,

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
1 chỉ trả về cái cuối cùng và
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
2 chỉ dải cái cuối cùng. (Xem ví dụ đầu tiên dưới đây).

Nếu path không có phần mở rộng, sẽ không trả lại phần tử

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
7 (xem ví dụ thứ hai bên dưới).

$path4

Nếu

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
6 của path bắt đầu bằng một dấu chấm, các ký tự sau được hiểu là
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
7 và
string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
8 trống (xem ví dụ thứ ba bên dưới).

Nếu flags có mặt, trả về một chuỗi chứa phần tử được yêu cầu.

$path5

$path6

$path7

$path8

$path9

Ví dụ

Ví dụ #1 PathInfo () Ví dụ

$flags0

$flags1

$flags2

$flags3

$flags4

$flags5

Ví dụ trên sẽ xuất ra:

Ví dụ #2 pathinfo () Ví dụ hiển thị sự khác biệt giữa null và không có phần mở rộng

$flags6

$flags7

$path9

Ví dụ trên sẽ xuất ra một cái gì đó tương tự như:

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

$flags9

PATHINFO_ALL0

$path9

Xem thêm

Dirname () - Trả về đường dẫn của thư mục cha mẹ

PATHINFO_ALL2

PATHINFO_ALL3

$path9

basename () - Trả về thành phần tên dấu vết của đường dẫn

parse_url () - phân tích URL và trả về các thành phần của nó

PATHINFO_ALL5

PATHINFO_ALL6

PATHINFO_ALL7

PATHINFO_ALL8

$path9

RealPath () - Trả về tên đường dẫn tuyệt đối chính thức

Lori ¶

..0

4 năm trước

498936940 tại qq dot com ¶

..1

..2

..3

..4

6 năm trước

Thông tin tại KGSW DOT de ¶

..5

..6

..7

1 năm trước

Thông tin tại KGSW DOT de ¶

..8

..6

..7

1 năm trước

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

path1

path2

$path9

Xem thêm

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

path4

Xem thêm

Dirname () - Trả về đường dẫn của thư mục cha mẹ

path5

basename () - Trả về thành phần tên dấu vết của đường dẫn

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

path6

path7

path8

path9

$path9

Xem thêm

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

flags1

flags2

flags3

flags4

Xem thêm

498936940 tại qq dot com ¶

flags5

flags6

$path9

6 năm trước

Thông tin tại KGSW DOT de ¶

flags8

flags9

$path9

1 năm trước

498936940 tại qq dot com ¶

PATHINFO_DIRNAME1

PATHINFO_DIRNAME2

$path9

6 năm trước

Thông tin tại KGSW DOT de ¶

PATHINFO_DIRNAME4

PATHINFO_DIRNAME5

PATHINFO_DIRNAME6

PATHINFO_DIRNAME7

1 năm trước

Lori ¶

PATHINFO_DIRNAME8

4 năm trước

498936940 tại qq dot com ¶

PATHINFO_DIRNAME9

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
00

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
01

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
02

6 năm trước

parse_url () - phân tích URL và trả về các thành phần của nó

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
03

RealPath () - Trả về tên đường dẫn tuyệt đối chính thức

498936940 tại qq dot com ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
04

6 năm trước

Thông tin tại KGSW DOT de ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
05

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
06

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
07

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
08

$path9

1 năm trước

Pietro Baricco ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
10

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
11

10 năm trước

Tom tại Foo-Bar Dot Co Dot Uk ¶

parse_url () - phân tích URL và trả về các thành phần của nó

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
13

RealPath () - Trả về tên đường dẫn tuyệt đối chính thức

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
14

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
15

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
01

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
17

Xem thêm

Ví dụ #1 PathInfo () Ví dụ

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
18

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
19

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
20

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
21

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
22

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
23

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
24

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
25

10 năm trước

Tom tại Foo-Bar Dot Co Dot Uk ¶

498936940 tại qq dot com ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
27

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
28

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
29

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
30

6 năm trước

Pietro Baricco ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
31

..6

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
33

10 năm trước

498936940 tại qq dot com ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
34

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
35

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
36

$path9

6 năm trước

Thông tin tại KGSW DOT de ¶

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
38

1 năm trước

parse_url () - phân tích URL và trả về các thành phần của nó

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
39

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
40

$path9

RealPath () - Trả về tên đường dẫn tuyệt đối chính thức

Ví dụ #3 PathInfo () Ví dụ cho tệp chấm

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
42

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
43

$path9

Qutechie tại Gmail Dot Com ¶

14 năm trước

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
45

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
46

..6

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
48

SmartDog tại Tut.by ¶

5 năm trước

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
49

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
50

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
51

$path9

Guy Dot Paddock tại Gmail Dot Com ¶

3 năm trước

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
53

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
54

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
55

string(0) ""

Notice: Undefined index: extension in test.php on line 6
NULL
56