[Php 4, Php 5, Php 7, Php 8]
require
giống hệt nhau bao gồm ngoại trừ khi thất bại, nó cũng sẽ tạo ra lỗi mức E_COMPILE_ERROR
gây tử vong. Nói cách khác, nó sẽ tạm dừng tập lệnh trong khi chỉ bao gồm chỉ phát ra cảnh báo [E_WARNING
] cho phép tập lệnh tiếp tục.include except upon failure it will also produce a fatal E_COMPILE_ERROR
level error. In other words, it will halt the script whereas include only emits a warning [E_WARNING
]
which allows the script to continue.
Xem tài liệu bao gồm cách thức hoạt động của nó.include documentation for how this works.
Chris tại Chrisstockton Dot org ¶ ¶
15 năm trước
Remember, when using require that it is a statement, not a function. It's not necessary to write:
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
Marcel Baur ¶ ¶
1 năm trước
If your included file returns a value, you can get it as a result from require[], i.e.
foo.php:
$bar = require["foo.php"];
echo $bar; // equals to "foo"
Osheros tại hotmail dot com ¶
1 tháng trước
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
[global.php]
$app_dir = "/app/path/here";
[main.php]
include "global.php";
E_COMPILE_ERROR
0
E_COMPILE_ERROR
1
Ẩn danh ¶ ¶
15 năm trước
E_COMPILE_ERROR
3
E_COMPILE_ERROR
4
E_COMPILE_ERROR
5
Marcel Baur ¶ ¶
1 năm trước
E_COMPILE_ERROR
7
E_COMPILE_ERROR
8
E_COMPILE_ERROR
9
Osheros tại hotmail dot com ¶
1 tháng trước
E_WARNING
1
E_WARNING
2
E_WARNING
3
Ẩn danh ¶ ¶
Dank tại Kegel Dot Com ¶
E_WARNING
5
E_WARNING
6
7 năm trước ¶
Richardbrenner [-at-] gmx [-] tại ¶
E_WARNING
8
E_WARNING
9
Remember, when using require that it is a statement, not a function. It's not necessary to write:
0
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
Remember, when using require that it is a statement, not a function. It's not necessary to write:
1
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
17 năm trước ¶
tjeerd ¶
Remember, when using require that it is a statement, not a function. It's not necessary to write:
3
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
Remember, when using require that it is a statement, not a function. It's not necessary to write:
4
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
Remember, when using require that it is a statement, not a function. It's not necessary to write:
5
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
16 năm trước ¶
Cánh ¶
Remember, when using require that it is a statement, not a function. It's not necessary to write:
7
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
Remember, when using require that it is a statement, not a function. It's not necessary to write:
8
The following:
Is preferred, it will prevent your peers from giving you a hard time and a trivial conversation about what require really is.
12 năm trước ¶
Dank tại Kegel Dot Com ¶
If your included file returns a value, you can get it as a result from require[], i.e.
0
If your included file returns a value, you can get it as a result from require[], i.e.
1
If your included file returns a value, you can get it as a result from require[], i.e.
2
7 năm trước ¶
15 năm trước
If your included file returns a value, you can get it as a result from require[], i.e.
4
If your included file returns a value, you can get it as a result from require[], i.e.
5
If your included file returns a value, you can get it as a result from require[], i.e.
6
If your included file returns a value, you can get it as a result from require[], i.e.
7
Marcel Baur ¶ ¶
1 năm trước
If your included file returns a value, you can get it as a result from require[], i.e.
9
foo.php:
0
$bar = require["foo.php"];
echo $bar; // equals to "foo"
foo.php:
1
$bar = require["foo.php"];
echo $bar; // equals to "foo"
foo.php:
2
$bar = require["foo.php"];
echo $bar; // equals to "foo"
foo.php:
3
$bar = require["foo.php"];
echo $bar; // equals to "foo"
foo.php:
4
$bar = require["foo.php"];
echo $bar; // equals to "foo"
Osheros tại hotmail dot com ¶
1 tháng trước
foo.php:
6
$bar = require["foo.php"];
echo $bar; // equals to "foo"
foo.php:
7
$bar = require["foo.php"];
echo $bar; // equals to "foo"
foo.php:
8
$bar = require["foo.php"];
echo $bar; // equals to "foo"
Ẩn danh ¶ ¶
Dank tại Kegel Dot Com ¶
0
1
Ẩn danh ¶ ¶
1 tháng trước
3
Ẩn danh ¶ ¶
15 năm trước
4
5
6
7
8
9
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
0
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
1
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
2
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
3
Marcel Baur ¶ ¶
Dank tại Kegel Dot Com ¶
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
5
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
6
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
7
7 năm trước ¶
Dank tại Kegel Dot Com ¶
When using an include file to define one or more global variables [to avoid having to redefine them in multiple files], make sure you're referencing the same variable.
9
[global.php]
0
$app_dir = "/app/path/here";
[global.php]
1
$app_dir = "/app/path/here";
7 năm trước ¶
Richardbrenner [-at-] gmx [-] tại ¶
[global.php]
3
$app_dir = "/app/path/here";
17 năm trước ¶
15 năm trước
[global.php]
4
$app_dir = "/app/path/here";
[global.php]
5
$app_dir = "/app/path/here";
tjeerd ¶ ¶
1 năm trước
[global.php]
7
$app_dir = "/app/path/here";
[global.php]
8
$app_dir = "/app/path/here";
[global.php]
9
$app_dir = "/app/path/here";
[main.php]
0
include "global.php";
[main.php]
include "global.php";
1Osheros tại hotmail dot com ¶
1 tháng trước
[main.php]
2
include "global.php";
[main.php]
3
include "global.php";