Dir::toArray PHP Method

toArray() public method

返回目录的数组信息
public toArray ( )
    public function toArray()
    {
        return $this->_values;
    }

Usage Example

 /**
  * 获取当前所有的表情
  * @param boolean $flush 是否更新缓存,默认为false
  * @return array 返回表情数据
  */
 public function getAllExpression($flush = false)
 {
     $cache_id = '_model_expression';
     if (($res = S($cache_id)) === false || $flush === true) {
         global $ts;
         // $pkg = $ts['site']['expression'];
         $pkg = 'miniblog';
         //TODO 临时写死
         $filepath = THEME_PUBLIC_PATH . '/image/expression/' . $pkg;
         require_once ADDON_PATH . '/library/io/Dir.class.php';
         $expression = new Dir($filepath);
         $expression_pkg = $expression->toArray();
         $res = array();
         foreach ($expression_pkg as $value) {
             /*				
                             if(!is_utf8($value['filename'])){
             					$value['filename'] = auto_charset($value['filename'],'GBK','UTF8');
             				}*/
             list($file) = explode(".", $value['filename']);
             $temp['title'] = $file;
             $temp['emotion'] = '[' . $file . ']';
             $temp['filename'] = $value['filename'];
             $temp['type'] = $pkg;
             $res[$temp['emotion']] = $temp;
         }
         S($cache_id, $res);
     }
     return $res;
 }
All Usage Examples Of Dir::toArray