特性

http://php.net/manual/zh/features.php

1.性状

2.闭包

3.生成器

4.内置http

例子 2-18 CSV生成器
[php] view plain copy
<?php  
function getRows($file) {  
    $handle = fopen($file, 'rb');  
    if ($handle === false) {  
        throw new Exception();  
    }  
    while (feof($handle) === false) {  
        yield fgetcsv($handle);  
    }  
    fclose($handle);  
}  
  
foreach (getRows('data.csv') as $row) {  
    print_r($row);  
}  

 

posted on 2016-01-12 21:07  阿卡贝拉  阅读(97)  评论(0)    收藏  举报