您好,欢迎访问一九零五行业门户网

PHP大数据处理要注意的

1. 传递值使用引用传递 $a = get_large_array(); pass_to_function($a); 这样是传递变量的引用而不是拷贝 2.将大数据存在类的变量中 class a { function first() { $this-a = get_large_array(); $this-pass_to_function(); } function pass_to_function() {
1. 传递值使用引用传递
$a = get_large_array(); 
pass_to_function(&$a); 
这样是传递变量的引用而不是拷贝
2.将大数据存在类的变量中
class a 

function first() 

$this->a = get_large_array(); 
$this->pass_to_function(); 

function pass_to_function() 

//process $this->a 


3.变量使用完毕后尽快的unset变量,释放内存,减小脚本负担负担。
其它类似信息

推荐信息