Archive for 二月, 2013

__destruct函数引起return失效

当在一个function中new一个包含__destruct的对象时,如果__destruct中exit; 将导致function return value失效.

function __destruct() {
	$this->isFinalized = true;
	$cd = null;
	$this->cdRec = null;
	//exit;
}
1 Comment more...

eID ts setup

First you make an instance of the tslib_fe class like:
$GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe',
        $GLOBALS['TYPO3_CONF_VARS'],
        t3lib_div::_GP('id'),
        t3lib_div::_GP('type'),
        and more variables if you want
);
(please check your incoming values 😉

Do some other stuff (check if you need this)
$GLOBALS['TSFE']->connectToMySQL();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->determineId();
$GLOBALS['TSFE']->getCompressedTCarray();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->getConfigArray();

And you can get the configuration at:
$configuration =
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_yourextension_controller.'];

转: transfer-encoding:chunked的含义

Transfer-Encoding: chunked 表示输出的内容长度不能确定,普通的静态页面、图片之类的基本上都用不到这个。

但动态页面就有可能会用到,但我也注意到大部分asp,php,asp.net动态页面输出的时候大部分还是使用Content-Length,没有使用Transfer-Encoding: chunked。

不过如果结合:Content-Encoding: gzip 使用的时候,Transfer-Encoding: chunked还是比较有用的。

记得以前实现:Content-Encoding: gzip 输出时,先把整个压缩后的数据写到一个很大的字节数组里(如 ByteArrayOutputStream),然后得到数组大小 -> Content-Length。

如果结合Transfer-Encoding: chunked使用,就不必申请一个很大的字节数组了,可以一块一块的输出,更科学,占用资源更少。

这在http协议中也是个常见的字段,用于http传送过程的分块技术,原因是http服务器响应的报文长度经常是不可预测的,使用Content-length的实体搜捕并不是总是管用。 (continue reading…)


Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress