$fp = fopen(sprintf("tmp/wk_exam_examination.%d.lock", $userid % 10), "w");
if (!flock($fp, LOCK_EX | LOCK_NB)) {
?>
<style>
#info {
text-align: center;
margin: 50px 0;
}
#info td {
font-size: 36px;
color: seagreen;
}
</style>
<div id='info'></div>
<script>
let sec = 5000
setTimeout(function () {
window.location.reload()
}, sec)
setInterval(function () {
sec -= 100
if (sec >= 0) {
let ok = sec / 1000
document.getElementById('info').innerHTML = `<table style="margin: 0 auto;">
<tr><td style='width: 50%; text-align: right;'>页面排队中...</td>
<td style="width: 2em; text-align: center;">${ok}</td><td>秒后将重试!</td></tr></table>`;
}
}, 100)
</script><?php
die;
}
分类目录归档:PHP
queue:listen queue:work的区别
queue:listen 是热加载,效率低,修改job类后会生效
queue:work 不会热加载,效率高,修改job类后需要重启才能生效
Warning: Swoole\Coroutine::create(): exceed max number of coroutine 100000
Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0
__construct、register_shutdown_function、__destruct执行顺序
run __construct
run shutdown_function
run __destruct
* unset 等操作可以提前触发 __destruct
可以利用变量作用域在__destruct内来释放连接、解锁等释放操作
启用 opcache.enable_cli 也需要小心
opcache.enable_cli + xdebug + swoole 可能会导致“段错误”(Segmentation fault)
BASE64URL JWT
PHP redis 分布式 可重入 锁 LUA脚本
[Symfony\Component\Process\Exception\ProcessTimedOutException] exceeded the timeout of 300 seconds.
[Symfony\Component\Process\Exception\ProcessTimedOutException] exceeded the timeout of 300 seconds.
解决办法:修改COMPOSER_PROCESS_TIMEOUT,默认是300秒,改大这个时间即可
# export COMPOSER_PROCESS_TIMEOUT=3600
# composer update