php¶àÏß³ÌÉÏÏÂÎÄÖа²È«Ð´Îļþ
Ìṩһ¸öphp¶àÏß³ÌÉÏÏÂÎÄÖа²È«Ð´ÎļþµÄʵÏÖ·½·¨¡£Õâ¸öʵÏÖûÓÐʹÓÃphp µÄfile lock»úÖÆ£¬Ê¹ÓõÄÊÇÁÙʱÎļþ»úÖÆ¡£¶àÏß³ÌÖеĸ÷¸öÏ̶߳¼ÊǶԸ÷×Ô£¨Ã¿¸öÏ̶߳ÀÕ¼Ò»¸ö£©µÄÁÙʱÎļþд£¬È»ºóÔÙͬ²½µ½ÔÎļþÖС£
<?php
/**
* @usage: used to offer safe file write operation in multiple threads context, arbitory file type
* @author: Rocky Zhang
* @time: Nov. 11 2009
* @demo[0]: $handler = mfopen($file, 'a+');
* mfwrite($handler, $str);
*/
function mfopen($file, $mode='w+') {
$tempfile = generateTempfile('./tempdir', $file);
preg_match('/b/i', $mode) || ($mode .= 'b'); // 'b' is recommended
if (preg_match('/\w|a/i', $mode) && !is_writable($file)) {
exit("{$file} is not writable!");
}
$filemtime = $filemtime2 = 0;
$tempdir = dirname($tempfile);
is_dir($tempdir) || mkdir($tempdir, 0777);
do { // do-while used to avoid modify in a long time copy
clearstatcache();
$filemtime = filemtime($file);
copy($file, $tempfile);
$filemtime2 = filemtime($file);
} while ( ($filemtime2 - $filemtime) != 0 );
if (!$handler = fopen($tempfile, $mode)) {
exit('Fail on opening tempfile, write authentication is must on temporary dir!');
}
return array(0=>$handler, 1=>$filemtime, 2=>$file, 3=>$tempfile, 4=>$mode);
}
// I do think that this function should be optimized further
function mfwrite(&$handler, $str='') {
if (strlen($str) > 0) {
$num = fwrite($handler[0], $str);
Ïà¹ØÎĵµ£º
APCÊÇÒ»ÖÖphpµÄ»º´æ½â¾ö·½°¸,ĿǰÒÔpecl·½Ê½·¢²¼,ÓÐÏûϢ˵½«»á³öÏÖÔÚphp6°æ±¾µÄÄÚºË.
Ò».°²×°·½·¨
1)´Óhttp://pecl.php.net/package/apcÏÂÔØÏàÓ¦°æ±¾
2)½âѹ
3)½øÈëÔ´ÂëĿ¼
4)Ö´ÐÐphp°²×°Ä¿Â¼ÏµÄbin/phpize
5)./configure --enable-apc --enable-apc-mmap --with-apxs=path-to-apache/bin/apxs --with-php-config=p ......
±¾ÕÂ˵˵±äÁ¿µÄ¶¨Òå¡£
Èç¹û¶ÔÓÚ±äÁ¿ºÍ³£Á¿µÄ¶¨Ò壬Äã»á×¢Ò⼸¸ö·½ÃæÄØ£¿Äã¿ÉÄÜ»áÏëµ½£º
ÈçºÎ¶¨Òå±äÁ¿£¬ËüºÍC# µÈÓïÑÔÓÐʲô²»Í¬ÄØ£¿
±äÁ¿Çø·Ö´óСдÂð£¿
PHPµÄ±äÁ¿»¹ÓÐÆäËûÖØÒªµÄÂð£¿
³£Á¿ºÍ±äÁ¿µÄ¶¨ÒåÒ»ÑùÂð£¿
·Ö±ð½²Êö°É¡£
1.ÈçºÎ¶¨Òå±äÁ¿£¬ËüºÍC# µÈÓïÑÔÓÐʲô²»Í¬ÄØ£¿
PHP ÖеıäÁ¿ÓÃÒ»¸ ......
¡¡¡¡/***************************
¡¡¡¡* author : ´óÁäÇàÄê
¡¡¡¡* email : wenadmin@sina.com
¡¡¡¡* from: http://blog.csdn.net/hahawen
¡¡¡¡* ×ªÔØÇë±£ÁôÕⲿ·ÖÐÅÏ¢£¬Ð»Ð»
¡¡¡¡***************************/
phpÒ³Ãæ·ÃÎÊʱ£¬Í³Ò»½øÐÐȨÏÞÑéÖ¤µÄÉè¼Æ
ÍíÉÏÓÐÈËÎÊÎÒ¹ØÓÚÍøÕ¾Ò³ÃæÏÔʾµÄʱºò£¬È¨ÏÞÅжϵÄÎÊÌâ¡£ÓÚÊǾÍÓ ......
<mce:script type="text/javascript" language="javascript"><!--
function del(com_id,meet_id){
$.ajax({
url:'../company/meet.Ajax.php',
type:'POST',
data:{com_id:com_id,meet_id:meet_id},
dataType:"json",
timeout: 10 ......
Óû§¶¨ÒåµÄÀ࣬ҲÊÇѧºÃ PHP Ëù±Ø±¸µÄÌõ¼þÖ®Ò»¡£
¶ø PHP µÄÀ࣬ºÍÆäËüµÄÃæÏò¶ÔÏóÓïÑÔ±È½ÏÆðÀ´£¬»¹ËãÂùµ¥´¿µÄ¡£
PHP Ö»ÓÐÀà±ð (class)¡¢·½·¨ (method)¡¢ÊôÐÔ¡¢ÒÔ¼°µ¥Ò»¼Ì³Ð (extensions) µÈ¡£
¶Ô²»Ï°¹ßʹÓà C++¡¢Java¡¢Delphi µÈÃæÏò¶ÔÏóÓïÑÔÀ´¿ª·¢³ÌÐòµÄÓû§£¬²»·ÁÏÈÔĶÁÒ»ÏÂÓйØÃæÏò¶ÔÏó¸ÅÄîµÄÊ飬ÏàÐÅ¿ÉÒÔ´øÀ´Ðí¶àµÄÊÕ ......