
Tôi đã viết mã PHP như thế này:
<?php
$i=0;
while($i<100) {
mail("","SPAM","It´s ".date("d.m.o H:i:s");
$i++;
}
echo "DONE!";
?>
Tôi đã lưu nó trong thư mục webserver. Tôi bắt đầu nó thông qua trình duyệt của tôi. Làm thế nào tôi có thể dừng tập lệnh trong khi thực hiện?during execution?
Bạn Đang Xem: Hướng dẫn force stop php script – buộc dừng tập lệnh php
Trân trọng 😉
Potashin
43.6K11 Huy hiệu vàng81 Huy hiệu bạc105 Huy hiệu Đồng11 gold badges81 silver badges105 bronze badges
Hỏi ngày 8 tháng 1 năm 2015 lúc 6:55Jan 8, 2015 at 6:55
3
Nếu bạn đang ở trên hệ thống Unix, hãy làm điều này:
ps aux | grep php
Nó sẽ liệt kê tất cả các quy trình đang chạy là trường hợp của PHP. Nếu tập lệnh của bạn được gọi là myscript.php, thì bạn sẽ thấy php /path/oto/myscript.php trong danh sách này khi nó chạy.
it will list all running processes which are instances of php. If you’re script is called myscript.php, then you should see php /path/to/myscript.php in this list when it’s running.
Bây giờ bạn có thể giết nó bằng lệnh kill -9 PID
Nếu bạn đang chạy trên Windows, bạn không thể (trừ khi bạn có thể kéo lên trình quản lý tác vụ theo cách thủ công) và nếu bạn chỉ có truy cập trình duyệt web vào máy chủ và bạn đang chạy tập lệnh qua máy chủ web một lần nữa, bạn không thể giết quá trình. Dù bằng cách nào chạy một tập lệnh vòng lặp vô hạn mà không có khả năng giết nó trên lệnh là một ý tưởng tồi.
Tham khảo cách phát hiện dừng hoặc chạy tập lệnh PHP từ ngoài và nền
Đã trả lời ngày 8 tháng 1 năm 2015 lúc 7:08Jan 8, 2015 at 7:08
1
Thoát (0); hay là chết(); hoặc phá vỡ; Bạn có thể sử dụng bất kỳ một. you can use any one.
<?php
$i=0;
while($i<100) {
mail("","SPAM","It´s ".date("d.m.o H:i:s");
exit(0);
$i++;
}
echo "DONE!";
?>
output: 0 //script is stop after printing 0.
Đã trả lời ngày 8 tháng 1 năm 2015 lúc 7:06Jan 8, 2015 at 7:06
PriyankpriyankPriyank
3.6403 huy hiệu vàng28 Huy hiệu bạc47 Huy hiệu đồng3 gold badges28 silver badges47 bronze badges
Bạn hoặc sử dụng exit()
hoặc die()
cho các mục đích này. Nhưng ví dụ của bạn, điều này không thực sự cần thiết vì kịch bản sẽ tự hủy bỏ sau khi nó chạy.
Đã trả lời ngày 8 tháng 1 năm 2015 lúc 6:59Jan 8, 2015 at 6:59
RealitätsverlustrealitätsverlustRealitätsverlust
3.9132 Huy hiệu vàng21 Huy hiệu bạc46 Huy hiệu đồng2 gold badges21 silver badges46 bronze badges
1
Xem Tắt
sunfundev tại gmail dot com
5 năm trước — Output a message and terminate the current script
Alexyam tại Live Dot Com ¶
10 năm trước(string $status
= ?): void
Devinemke tại Devinemke dot com(int $status
): void
20 năm trước
Powtac tại GMX de ¶
4 năm trước
Shaun tại Noshatspam Dot Net
Chris at Ocproducts Dot Com ¶int, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be
used. The status 0 is used to terminate the program successfully.
Matt tại serverboy dot net ¶
Kehaovista tại qq dot com ¶
6 năm trước
Alexander Behling ¶
<?php
$i=0;
while($i<100) {
mail("","SPAM","It´s ".date("d.m.o H:i:s");
exit(0);
$i++;
}
echo "DONE!";
7
<?php
$i=0;
while($i<100) {
mail("","SPAM","It´s ".date("d.m.o H:i:s");
exit(0);
$i++;
}
echo "DONE!";
8
<?php
$i=0;
while($i<100) {
mail("","SPAM","It´s ".date("d.m.o H:i:s");
exit(0);
$i++;
}
echo "DONE!";
9
1 năm trước
output: 0 //script is stop after printing 0.
1
(Php 4, Php 5, Php 7, Php 8)
output: 0 //script is stop after printing 0.
2
output: 0 //script is stop after printing 0.
3
output: 0 //script is stop after printing 0.
4
Thoát – xuất một tin nhắn và chấm dứt tập lệnh hiện tại
Shutdown: shutdown() Destruct: Foo::__destruct()
Sự mô tả ¶
11 năm trước
output: 0 //script is stop after printing 0.
Xem Thêm : 5 bài tập tiếng anh lớp 4 unit 7 hot nhất, đừng bỏ lỡ
5
output: 0 //script is stop after printing 0.
6
output: 0 //script is stop after printing 0.
7
output: 0 //script is stop after printing 0.
8
output: 0 //script is stop after printing 0.
9
Albert tại Removeethis Dot Peschar Dot Net ¶
13 năm trước
Shutdown: shutdown() Destruct: Foo::__destruct()
0
Shutdown: shutdown() Destruct: Foo::__destruct()
1
Shutdown: shutdown() Destruct: Foo::__destruct()
2
Shutdown: shutdown() Destruct: Foo::__destruct()
3
theonenkl tại gmail dot com ¶ ¶
7 năm trước
Shutdown: shutdown() Destruct: Foo::__destruct()
4
Shutdown: shutdown() Destruct: Foo::__destruct()
Xem Thêm : 5 bài tập tiếng anh lớp 4 unit 7 hot nhất, đừng bỏ lỡ
5
Shutdown: shutdown() Destruct: Foo::__destruct()
6
Shutdown: shutdown() Destruct: Foo::__destruct()
7
Shutdown: shutdown() Destruct: Foo::__destruct()
8
Vincent dot laag tại gmail dot com ¶ ¶
12 năm trước
Shutdown: shutdown() Destruct: Foo::__destruct()
9
vô hiệu hóa một thông tin t t thông tin ¶ ¶
13 năm trước
ps aux | grep php
0
ps aux | grep php
1
ps aux | grep php
2
ps aux | grep php
3
ps aux | grep php
4
ps aux | grep php
5
Shutdown: shutdown() Destruct: Foo::__destruct()
3
Emils tại TVNet Dot LV ¶ ¶
19 năm trước
ps aux | grep php
7
m dot ressergolis tại gmail dot com ¶ ¶
7 năm trước
ps aux | grep php
8
ps aux | grep php
9
kill -9 PID
0
kill -9 PID
1
kill -9 PID
2
Shutdown: shutdown() Destruct: Foo::__destruct()
3
Vincent dot laag tại gmail dot com ¶ ¶
12 năm trước
kill -9 PID
4
kill -9 PID
5
Xem Thêm : supernovae là gì – Nghĩa của từ supernovae
kill -9 PID
6
kill -9 PID
7
kill -9 PID
8
vô hiệu hóa một thông tin t t thông tin ¶ ¶
Emils tại TVNet Dot LV ¶
kill -9 PID
9
exit()
0
exit()
1
exit()
2
Shutdown: shutdown() Destruct: Foo::__destruct()
3
19 năm trước ¶
m dot ressergolis tại gmail dot com ¶
exit()
4
exit()
5
exit()
6
Shutdown: shutdown() Destruct: Foo::__destruct()
3
sunfundev tại gmail dot com ¶
5 năm trước
exit()
8
Alexyam tại Live Dot Com ¶ ¶
m dot ressergolis tại gmail dot com ¶
exit()
9
die()
0
die()
1
Shutdown: shutdown() Destruct: Foo::__destruct()
3
sunfundev tại gmail dot com ¶
5 năm trước
die()
3
die()
4
Shutdown: shutdown() Destruct: Foo::__destruct()
3
Alexyam tại Live Dot Com ¶ ¶
12 năm trước
die()
6
die()
7
die()
8
die()
9
Shutdown: shutdown() Destruct: Foo::__destruct()
3
vô hiệu hóa một thông tin t t thông tin ¶ ¶
Emils tại TVNet Dot LV ¶
$status
1
$status
2
$status
3
19 năm trước ¶
m dot ressergolis tại gmail dot com ¶
$status
4
$status
5
$status
6
$status
7
$status
8
$status
9
Shutdown: shutdown() Destruct: Foo::__destruct()
3
Nguồn: https://quatangtiny.com
Danh mục: Blog