gistfile1.txt(檔案已創建)
| @@ -0,0 +1,15 @@ | |||
| 1 | + | The Basic Anatomy of a Fiber | |
| 2 | + | The beauty of PHP Fibers is in their simplicity. Here’s how to create a fiber and get it up and running: | |
| 3 | + | ||
| 4 | + | $fiber = new Fiber(function() { | |
| 5 | + | echo "Fiber started…\n"; | |
| 6 | + | Fiber::suspend(); // Pause the fiber | |
| 7 | + | echo "Fiber resumed…\n"; | |
| 8 | + | }); | |
| 9 | + | echo "Fiber starting…\n"; | |
| 10 | + | $fiber->start(); // Start the fiber | |
| 11 | + | echo "Main script running…\n"; | |
| 12 | + | $fiber->resume(); // Resume the fiber | |
| 13 | + | ||
| 14 | + | https://byteblog.medium.com/php-fibers-how-php-is-finally-warming-up-to-asynchronous-programming-39da4d21b8e7 | |
| 15 | + | https://itsimiro.medium.com/understanding-fibers-in-php-a-new-way-to-handle-concurrency-ed07424320ff | |
上一頁
下一頁