[Php 4> = 4.0.3, Php 5, Php 7, Php 8]
PathInfo - Trả về thông tin về đường dẫn tệp — Returns 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
________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 NULL0,
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL1 hoặc
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL2.
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 NULL5,
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL6,
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL7 [if any], and
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL8.
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 NULL1 returns only the last one andstring[0] "" Notice: Undefined index: extension in test.php on line 6 NULL2 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
$path
0
$path
1Thông số
/www/htdocs/inc lib.inc.php php lib.inc
path
pathinfo[] example showing difference between null and no extension
$path
2
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
$path
3
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ặcstring[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].
$path
4
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.
$path
5
$path
6
$path
7
$path
8
$path
9Ví dụ ¶
Ví dụ #1 PathInfo [] Ví dụ
$flags
0
$flags
1
$flags
2
$flags
3
$flags
4
$flags
5Ví 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
$flags
6
$flags
7
$path
9Ví 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
$flags
9
PATHINFO_ALL
0
$path
9Xem thêm ¶
Dirname [] - Trả về đường dẫn của thư mục cha mẹ
PATHINFO_ALL
2
PATHINFO_ALL
3
$path
9basename [] - 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_ALL
5
PATHINFO_ALL
6
PATHINFO_ALL
7
PATHINFO_ALL
8
$path
9RealPath [] - 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
..
46 năm trước ¶
Thông tin tại KGSW DOT de ¶
..
5
..
6
..
71 năm trước ¶
Thông tin tại KGSW DOT de ¶
..
8
..
6
..
71 năm trước ¶
Ví dụ #3 PathInfo [] Ví dụ cho tệp chấm
path
1
path
2
$path
9Xem thêm ¶
Ví dụ #3 PathInfo [] Ví dụ cho tệp chấm
path
4
Xem thêm ¶
Dirname [] - Trả về đường dẫn của thư mục cha mẹ
path
5
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
path
6
path
7
path
8
path
9
$path
9Xem thêm ¶
Ví dụ #3 PathInfo [] Ví dụ cho tệp chấm
flags
1
flags
2
flags
3
flags
4Xem thêm ¶
498936940 tại qq dot com ¶
flags
5
flags
6
$path
96 năm trước ¶
Thông tin tại KGSW DOT de ¶
flags
8
flags
9
$path
91 năm trước ¶
498936940 tại qq dot com ¶
PATHINFO_DIRNAME
1
PATHINFO_DIRNAME
2
$path
96 năm trước ¶
Thông tin tại KGSW DOT de ¶
PATHINFO_DIRNAME
4
PATHINFO_DIRNAME
5
PATHINFO_DIRNAME
6
PATHINFO_DIRNAME
71 năm trước ¶
Lori ¶
PATHINFO_DIRNAME
8
4 năm trước ¶
498936940 tại qq dot com ¶
PATHINFO_DIRNAME
9
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL00
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL01
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL02
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 NULL03
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 NULL04
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 NULL05
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL06
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL07
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL08
$path
91 năm trước ¶
Pietro Baricco ¶
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL10
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL1110 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 NULL13
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 NULL14
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL15
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL01
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL17
Xem thêm ¶
Ví dụ #1 PathInfo [] Ví dụ
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL18
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL19
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL20
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL21
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL22
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL23
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL24
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL2510 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 NULL27
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL28
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL29
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL30
6 năm trước ¶
Pietro Baricco ¶
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL31
..
6
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL33
10 năm trước ¶
498936940 tại qq dot com ¶
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL34
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL35
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL36
$path
96 năm trước ¶
Thông tin tại KGSW DOT de ¶
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL38
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 NULL39
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL40
$path
9RealPath [] - 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 NULL42
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL43
$path
9Qutechie tại Gmail Dot Com ¶ ¶
14 năm trước
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL45
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL46
..
6
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL48
SmartDog tại Tut.by ¶ ¶
5 năm trước
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL49
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL50
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL51
$path
9Guy Dot Paddock tại Gmail Dot Com ¶ ¶
3 năm trước
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL53
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL54
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL55
string[0] "" Notice: Undefined index: extension in test.php on line 6 NULL56