php

Working with multiple PHP versions on MAC OS-X

Today I had to update a project that was developed using WordPress and PHP 5.3. Today I have PHP 5.4 installed on my machine and this newer version abandoned some old features, and you have some Fatal errors like Call-time pass-by-reference has been removed. The solution was go back to PHP 5.3 and do the updates on my the project, because the production server is with PHP 5.3 too. (continue reading…)


8 Best Php Libraries for Developers

 

php-error

The goal of the Standard PHP Library-or SPL, in brief-is to provide a standard library of interfaces which allows developers to take full advantage of object-oriented programming in PHP 5.Therefore in this article we have collected 8 of the best PHP Libraries which will assist and help developers to simplify their work and serve their development tasks.

If you like the article you might be interested in our other article on 8 Best Php Tools and Applications for Developers” (continue reading…)


html转义字符

编码转换(to Unicode)
(程序代码来源于网络)

Js版


(continue reading…)


精简版uc_client

在应用需要整合ucenter时候需要用到 uc_client 目录,而往往我们并不需要那么多功能,那么有没有简单的方法呢?下面一个文件搞定ucenter 主要接口,包含,注册,登录,退出,同步登录相关接口。

(continue reading…)


德语字符排序

mb_internal_encoding("UTF-8");
$array1 = array('aümg', 'abc', 'aécas', 'bdö', 'äsasf', 'aäfa');
uasort($array1, 'utf_8_german::cmp');
var_dump($array3);
Result: array(6) { [5]=> string(5) "aäfa" [1]=> string(3) "abc" [2]=> string(6) "aécas" [0]=> string(5) "aümg" [4]=> string(6) "äsasf" [3]=> string(4) "bdö" }

(continue reading…)


__destruct函数引起return失效

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

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

php soap验证

soapheader… (continue reading…)


PHPExcel demo function

直接使用, 数据第一个元素是column name. (continue reading…)


PHPExcel解决内存占用过大问题-设置单元格对象缓存

PHPExcel是一个很强大的处理Excel的PHP开源类,但是很大的一个问题就是它占用内存太大,从1.7.3开始,它支持设置cell的缓存方式,但是推荐使用目前稳定的版本1.7.6,因为之前的版本都会不同程度的存在bug,以下是其官方文档:

PHPExcel1.7.6官方文档 写道

PHPExcel uses an average of about 1k/cell in your worksheets, so large workbooks can quickly use up available memory. Cell caching provides a mechanism that allows PHPExcel to maintain the cell objects in a smaller size of memory, on disk, or in APC, memcache or Wincache, rather than in PHP memory. This allows you to reduce the memory usage for large workbooks, although at a cost of speed to access cell data.

PHPExcel平均下来使用1k/单元格的内存,因此大的文档会导致内存消耗的也很快。单元格缓存机制能够允许PHPExcel将内存中的小的单元格对象缓存在磁盘或者APC,memcache或者Wincache中,尽管会在读取数据上消耗一些时间,但是能够帮助你降低内存的消耗。

PHPExcel1.76.官方文档 写道
By default, PHPExcel still holds all cell objects in memory, but you can specify alternatives. To enable cell caching, you must call the PHPExcel_Settings::setCacheStorageMethod() method, passing in the caching method that you wish to use.

默认情况下,PHPExcel依然将单元格对象保存在内存中,但是你可以自定义。你可以使用PHPExcel_Settings::setCacheStorageMethod()方法,将缓存方式作为参数传递给这个方法来设置缓存的方式。
(continue reading…)


IP保护

http://www.maxmind.com/download/geoip/api/php/


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