function index_get_invoice_query()
{
    $sql = 'SELECT o.order_sn, o.invoice_no, s.shipping_code FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o' .
            ' LEFT JOIN ' . $GLOBALS['ecs']->table('shipping') . ' AS s ON s.shipping_id = o.shipping_id' .
            " WHERE invoice_no > '' AND shipping_status = " . SS_SHIPPED.
            ' ORDER BY shipping_time DESC LIMIT 10';
//echo $sql;
    $all = $GLOBALS['db']->getAll($sql);
    print_r($all);
    foreach ($all AS $key => $row)
    {
        $plugin = ROOT_PATH . 'includes/modules/shipping/' . $row['shipping_code'] . '.php';        if (file_exists($plugin))
        {
            include_once($plugin);            $shipping = new $row['shipping_code'];
            $all[$key]['invoice_no'] = $shipping->query((string)$row['invoice_no']);
        }
    }    clearstatcache();    return $all;}打印数组为Array ( [0] => Array ( [order_sn] => 2009030695164 [invoice_no] => 2009030695164 [shipping_code] => cac ) ) 

解决方案 »

  1.   

    正解emptybool empty ( mixed var )如果 var 是非空或非零的值,则 empty() 返回 FALSE。换句话说,""、0、"0"、NULL、FALSE、array()、var $var; 以及没有任何属性的对象都将被认为是空的,如果 var 为空,则返回 TRUE。
      

  2.   

    嗯,手册上有详细的解释
    查empty函数即可
      

  3.   

    建议lz去下载一个文档,
    参考文档写程序是最高效的。PHP中文版开发手册[CHM]适合PHP4/PHP5
      

  4.   

     .....
    ...........
    $all = $GLOBALS['db']->getAll($sql);
        print_r($all);
    if(!is_array($all)||count($all)==0) return array();
    ....
    ...
      

  5.   

    empty用来判断变量的
    判断数组应该用
    if(!is_array($ary) || count($ary)==0){
        echo '数组为空';
        exit;
    }
      

  6.   

    还有一种方法:
    if (sizeof($ary)>0){
      echo '数组不为空'; 
    }else{
     echo '数组为空'; 
    }