PHP中使用pcntl和libevent實(shí)現(xiàn)Timer功能_PHP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:百度網(wǎng)盤文件直鏈PHP代碼通過正則表達(dá)式獲取百度網(wǎng)盤的文件真實(shí)地址,來實(shí)現(xiàn)直鏈的效果,適合一些使用外鏈的網(wǎng)站使用。 ?php $canshu=$_SERVER[QUERY_STRING]; if($canshu==) { die(文件不存在); } else { $wangzhi=http://pan.baidu.com/share/link?.$canshu; $file=file_get_contents($wangz
<?php
function newChild($func_name) { echo "enter newChildn"; $args = func_get_args(); unset($args[0]); $pid = pcntl_fork(); if ($pid == 0) { function_exists($func_name) and exit(call_user_func_array($func_name, $args)) or exit(-1); } else if($pid == -1) { echo "Couldn't create child process"; } else { return $pid; } } function on_timer() { echo "timer calledn"; } /** * @param $func string, function name * @param $timeouts int, microtimes for time delay */ function timer($func, $timeouts){ echo "enter timern"; $base = event_base_new(); $event = event_new(); event_set($event, 0, EV_TIMEOUT, $func); event_base_set($event, $base); event_add($event, $timeouts); event_base_loop($base); } $pid = newChild("timer", "on_timer", 5000000); if ($pid > 0) { echo "master process exitn"; }分享:php 將 HTML 轉(zhuǎn)換成文本? php // $document 應(yīng)包含一個(gè) HTML 文檔。 // 本例將去掉 HTML 標(biāo)記,javascript 代碼 // 和空白字符。還會(huì)將一些通用的 // HTML 實(shí)體轉(zhuǎn)換成相應(yīng)的文本。 $search = array ('script[^]*?.*?/script'si, // 去掉 javascript '[/!]*?[^]*?'si, // 去掉 HTML 標(biāo)記 '([rn
相關(guān)PHP教程:
- PHPNOW安裝Memcached擴(kuò)展方法詳解
- php記錄頁面代碼執(zhí)行時(shí)間
- PHP中獎(jiǎng)概率的抽獎(jiǎng)算法程序代碼
- apache設(shè)置靜態(tài)文件緩存方法介紹
- php對(duì)圖像的各種處理函數(shù)代碼小結(jié)
- PHP 關(guān)于訪問控制的和運(yùn)算符優(yōu)先級(jí)介紹
- 關(guān)于PHP語言構(gòu)造器介紹
- php/js獲取客戶端mac地址的實(shí)現(xiàn)代碼
- php5.5新數(shù)組函數(shù)array_column使用
- PHP preg_match的匹配多國(guó)語言的技巧
- php 中序列化和json使用介紹
- php采集文章中的圖片獲取替換到本地
- 相關(guān)鏈接:
- 教程說明:
PHP教程-PHP中使用pcntl和libevent實(shí)現(xiàn)Timer功能
。