Press "Enter" to skip to content

246 search results for "php"

浏览器多tab打开同一URL串行化的问题

最近同事"神经病"同学的项目中, 发现一个问题.
用firefox打开多个tab, 每个tab都去请求同一个URL(尽量同时), 会发现, 这些请求, 会被浏览器串行化.
也就是说, 浏览器会在第一个页面请求结束以后, 再发起第二个请求,
比如对于如下脚本:

<?php
error_log("start . " . getmypid(). "\n");
sleep(5);
error_log("end . " . getmypid() . "\n");

Filed in GNU C/C++, PHP应用
with 12 Comments

Zend Parameters Parser新增类型描述符介绍

从PHP5.3开始, zend_parse_paramters_*函数新增了如下几个新的类型描述符:

f  - function or array containing php method call info (returned as
      zend_fcall_info and zend_fcall_info_cache)
H  - array or HASH_OF(object) (returned as HashTable*)
L  - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
Z  - the actual zval (zval**)
*  - variable arguments list (0 or more)
+  - variable arguments list (1 or more)

这也使得我们做扩展开发的时候, 能更加轻松的处理输入参数, 得到想要的值.

Filed in PHP应用, PHP源码分析
with 4 Comments

在Windows下编译Yaf

昨天大草原同学完成了在VS9下编译PHP-5.2.15和Yaf, 转发给我相关步骤描述.
其实本质上在win32和Linux下编译没什么区别, 都是只要正确设置CFLAGS和LDFLAGS就可以了, 但微软老喜欢搞成配置, 各种各样的配置项, 搞得人郁闷的不行.
特转载于此, 供大家参考.

Filed in PHP应用, 转载
with 21 Comments

Apache Access Log中的Options的含义

说是, 在Apache的Access Log中会看到很多如下的访问日志:

127.0.0.1 - - [05/May/2011:10:54:07 +0800] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [05/May/2011:10:54:08 +0800] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [05/May/2011:10:54:09 +0800] "OPTIONS * HTTP/1.0" 200 -
127.0.0.1 - - [05/May/2011:10:54:10 +0800] "OPTIONS * HTTP/1.0" 200 -

这是什么意思呢?

Filed in Linux/Unix
with 8 Comments

Serialize/Unserialize破坏单例

我们经常采用如下方式定义单列:

class Singleton {
    private static $instance = NULL;
    /** 不容许直接调用构造函数 */
    private function __construct() {
    }
    /** 不容许深度复制 */
    private function __clone() {
    }
    public static function getInstance() {
        if (NULL === self::$instance) {
        	self::$instance = new self();
		}
        return self::$instance;
    }
}

很多人都会记得对深度copy的保护, 但, 其实我们却疏忽了一点...

Filed in PHP应用, 随笔
with 15 Comments

Can't find what you're looking for? Try refining your search: