摘要:
#CIserver { listen 80; server_name www.ci.com; index index.php index.html index.htm; root "/servers/apps/CI"; location ~ \\.php{ fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; ##########################################pathinfo 模式 set $path_info ""; set $real_script_nam... 阅读全文
摘要:
js代码scroll.photo.js :window.imgscroll = { options: { target: null, //插入图片的目标位置 img_list: null, //图片数组 [{ url: "/CMF01_000.jpg"},{ url: "/CMF01_001.jpg"}] img_max: 0, //图片数量 img_num: 0, //图片累计已加载的数量 step_max: 3, //每轮加载图片的数量 从0开始计数 step_num: 0, //每轮已加载图片的数量... 阅读全文
摘要:
jQuery mobilehttp://jquerymobile.comhttp://www.jqmapi.com/http://www.wglong.com/main/artical!demos#swipehttp://www.photoswipe.com/phonegaphttp://www.phonegapcn.com/developers/toolshttp://mobile.51cto.com/hot-273792.htm 阅读全文
摘要:
function checkBOM ($filename) { $contents = file_get_contents($filename); $charset[1] = substr($contents, 0, 1); $charset[2] = substr($contents, 1, 1); $charset[3] = substr($contents, 2, 1); if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191... 阅读全文
摘要:
ext 与 PHP 交互时,ext 把 json 数据 post 给 PHP,但在 PHP里面 $_post 获取不到,$_REQUEST 也获取不到,但是通过 firedebug 看到的请求信息确实是把 JSON 数据 post 给了 PHP。想到以前通过flash将图片二进制流传给PHP,然后使用 $GLOBALS['HTTP_RAW_POST_DATA'] 后正常获取到数据。PHP 默认只识别 application/x-www.form-urlencoded 标准的数据类型,因此,对型如 text/xml 或者 soap 或者 application/octet-str 阅读全文
摘要:
$data = array("name" => "Hagrid", "age" => "36");$data_string = json_encode($data);$ch = curl_init('http://api.local/rest/users');curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);curl_set 阅读全文
摘要:
如果是在linux下, 首先确认是否添加 ob_start() 和 ob_flush().ob_start();for ($i=1; $i<=10; $i++) { echo $i."<br />\n"; ob_flush(); flush(); usleep(500000);}如果还是不能输出的话, 就在代码前面加上头信息header("Content-Type:text/html;charset=utf8;");ob_start();for ($i=1; $i<=10; $i++) { echo $i."<br 阅读全文
摘要:
buffer ---- flush() buffer是一个内存地址空间,Linux系统默认大小一般为4096(1kb),即一个内存页。主要用于存储速度不同步的设备或者优先级不同的 设备之间传办理数据的区域。通过buffer,可以使进程这间的相互等待变少。这里说一个通俗一点的例子,你打开文本编辑器编辑一个文件的时候,你每输入 一个字符,操作系统并不会立即把这个字符直接写入到磁盘,而是先写入到buffer,当写满了一个buffer的时候,才会把buffer中的数据写入磁 盘,当然当调用内核函数flush()的时候,强制要求把buffer中的脏数据写回磁盘。 同样的道理,当执行echo,prin.. 阅读全文
摘要:
使用 PHP 直接在共享内存中存储数据集:http://www.ibm.com/developerworks/cn/opensource/os-php-shared-memory/使用共享内存实现php Spinlock:http://bbs.phpchina.com/thread-218881-1-1.html基于PHP共享内存实现的消息队列可以参考,代码来源于网络:<?php/*** 使用共享内存的PHP循环内存队列实现* 支持多进程, 支持各种数据类型的存储* 注: 完成入队或出队操作,尽快使用unset(), 以释放临界区** @author wangbinandi@gmail. 阅读全文
摘要:
原文地址:http://blog.csdn.net/sparkliang/article/details/5279393consistent hashing算法早在1997年就在论文Consistent hashing and random trees中被提出,目前在cache系统中应用越来越广泛;1基本场景比如你有N个cache服务器(后面简称cache),那么如何将一个对象object映射到N个cache上呢,你很可能会采用类似下面的通用方法计算object的hash值,然后均匀的映射到到N个cache;hash(object)%N一切都运行正常,再考虑如下的两种情况;1一个cache服务 阅读全文