Travel is a small php extension provided and maintained by Rachid Laasri, which uses Carbon to help you perform certain operations back to a specific time and return.
Travel::to('November 5, 1955'); // Stop Biff // 回到某天 Travel::to('October 26, 1985');
The following is an example of executing some time-sensitive code in a closure and returning the current time after the execution is completed:
Travel::to('-5 minutes', function() { // 逻辑代码 });
If you have already used time travel, please do not Forgot to execute the following method to return the current point in time.
Travel::back();
For details, please check GitHub rashidlaasri/travel
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of Carbon-based time travel Travel expansion pack. For more information, please follow other related articles on the PHP Chinese website!