正如手冊所述https://www.php.net/manual/en/function.flock.phpOn versions of PHP before 5.3.2, the lock is released also by fclose() (which is also called automatically when script finished).據(jù)我了解,自 5.3.2 版以來,鎖不會自動釋放。那是對的嗎?此外,這會導致問題,如果在腳本執(zhí)行已被客戶端(通過 HTTP 請求或 CLI)中止時釋放鎖。
1 回答

holdtom
TA貢獻1805條經(jīng)驗 獲得超10個贊
從 5.3.2 開始,鎖不會自動釋放
如果在解鎖前終止腳本。PHP 不會解鎖它。然后,您必須中繼操作系統(tǒng)才能這樣做。
簡而言之:永遠解鎖??
- 1 回答
- 0 關注
- 123 瀏覽
添加回答
舉報
0/150
提交
取消