``` new C2, 'me' => '__invoke'], ]; class C1 {} class C2 { public function __invoke() {} public function aaa() {} } class SC1 { public static function sc11() {} } foreach ($callables as $callable) { var_dump(resolveCallable($callable)); echo "\n"; } /** * 将可能可执行的内容转换成is_callable可识别的callable * 可识别内容: * 任何is_callable()===true的callable * 任意存在且含有__invoke方法的AnyClass::class * * @param string $callable 可能可执行的内容 * @param bool $return_false 当发生无法转换时,是否返回false,默认返回一个空匿名函数 * @return callable | false */ function resolveCallable($callable, $return_false = false) { if (is_callable($callable)) { return $callable; } elseif (is_string($callable) && class_exists($callable)) { return resolveCallable(new $callable, $return_false); } elseif (is_array($callable) && @$callable[1] === '__invoke') { return resolveCallable(@$callable[0], $return_false); } else { return $return_false ? false : function () {}; } } ```
``` IE11 WIN10 64 Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko Edge WIN10 64 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14379 Chrome WIN10 64 Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge WM10 Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1; Microsoft; RM-1113) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Mobile Safari/537.36 Edge/14.14379 IE6 Mozilla/4.0 (Windows; MSIE 6.0; Windows NT 5.2) IE7 Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0) IE8 Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0) IE9 Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) IE10 Mozilla/5.0 (compatible; WOW64; MSIE 10.0; Windows NT 6.2) Safari iOS7 mozilla/5.0 (iphone; cpu iphone os 7_0_2 like mac os x) applewebkit/537.51.1 (khtml, like gecko) version/7.0 mobile/11a501 safari/9537.53 Android Nexus10 Mozilla/5.0 (Linux; Android 4.2.0; Nexus 10 Build/JOP24G) AppleWebKit/537.51.1 (KHTML, like Gecko) Chrome/51.0.2704.79 Mobile Safari/537.36 IOS 10 Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.6.1 NetType/WIFI Language/zh_HK MAC Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/11.0.2 Safari/604.4.7 ```
### Cron表达式的构成 | 字段(域) | 必须 | 允许值 | 允许特殊值 | | ------------ | :------------:| ------------ | ------------ | | 秒 | 是 | 0-59 | , – * / | | 分 | 是 | 0-59 | , – * / | | 小时 | 是 | 0-23 | , – * / | | 日 | 是 | 1-31 | , – * ? / L W C | | 月 | 是 | 0-11 或者 JAN-DEC | , – * / | | 周 | 是 | 1-7 或者 SUN-SAT | , – * ? / L C # | | 年 | 否 | 空 或者 1970-2099 | , – * / | - 阅读剩余部分 -
- 阅读剩余部分 -
服务器推荐