为了更好的控制php程序同时操作的一些问题我整理了一个进程锁的类我们可以利用这个进程锁实现程序的控制,程序代码如下:
= self::gettimeout()){ self::unlock(); return false; }else{ return true; } } static public function gettimeout(){ $key = str_replace(self::__getkey(), '_lock', '_timeout'); $expire = c($key) ? c($key) : self::phplock_timeout; return $expire; } static private function __getkey(){ return (defined('group_name') ? group_name.'_' : '') . module_name . '_' . action_name . '_lock'; } }
文章链接:
随便收藏,请保留本文地址!