当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPZip::add_file方法代码示例

本文整理汇总了PHP中PHPZip::add_file方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPZip::add_file方法的具体用法?PHP PHPZip::add_file怎么用?PHP PHPZip::add_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPZip的用法示例。


在下文中一共展示了PHPZip::add_file方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: implode

    $goods_value['warn_number'] = 0;
    $goods_value['is_best'] = 0;
    $goods_value['is_new'] = 0;
    $goods_value['is_hot'] = 0;
    $goods_value['is_on_sale'] = 1;
    $goods_value['is_alone_sale'] = 1;
    $goods_value['is_real'] = 1;
    $content = '"' . implode('","', $_LANG['ecshop']) . "\"\n";
    while ($row = $db->fetchRow($res)) {
        $goods_value['is_on_sale'] = $row['is_on_sale'];
        $goods_value['is_alone_sale'] = $row['is_alone_sale'];
        $goods_value['is_real'] = $row['is_real'];
        $content .= implode(",", $goods_value) . "\n";
    }
    $charset = empty($_POST['charset']) ? 'GBK' : trim($_POST['charset']);
    $zip->add_file(ecs_iconv(EC_CHARSET, $charset, $content), 'goods_list.csv');
    header("Content-Disposition: attachment; filename=goods_list.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
} elseif ($_REQUEST['act'] == 'upload') {
    /* 检查权限 */
    admin_priv('shop_authorized');
    /* 接收上传文件 */
    /* 取出证书内容 */
    $license_arr = array();
    if (isset($_FILES['license']['error']) && $_FILES['license']['error'] == 0 && preg_match('/CER$/i', $_FILES['license']['name'])) {
        if (file_exists($_FILES['license']['tmp_name']) && is_readable($_FILES['license']['tmp_name'])) {
            if ($license_f = fopen($_FILES['license']['tmp_name'], 'r')) {
                $license_content = '';
                while (!feof($license_f)) {
                    $license_content .= fgets($license_f, 4096);
开发者ID:dalinhuang,项目名称:hteacher,代码行数:31,代码来源:license.php

示例2: while

    while ($row_www_com = $GLOBALS['db']->fetchRow($res_www_com)) {
        $user_value['user_name'] = $row_www_com['user_name'];
        $user_value['email'] = $row_www_com['email'];
        /* 处理会员等级 */
        $user_value['user_rank'] = " ";
        if ($row_www_com['user_rank']) {
            $user_value['user_rank'] = $rank_list_www_com[$row_www_com['user_rank']];
        } else {
            foreach ($rank_list_www_com[0] as $rank_temp) {
                if ($row_www_com['rank_points'] >= $rank_temp['min_points'] and $row_www_com['rank_points'] < $rank_temp['max_points']) {
                    $user_value['user_rank'] = $rank_temp['rank_name'];
                    break;
                }
            }
        }
        /* 处理电话(家庭电话、办公电话) */
        $user_value['tel_phone'] = $row_www_com['home_phone'];
        $user_value['tel_phone'] .= !empty($row_www_com['home_phone']) && !empty($row_www_com['office_phone']) ? "或" : "";
        $user_value['tel_phone'] .= $row_www_com['office_phone'];
        $user_value['mobile_phone'] = $row_www_com['mobile_phone'];
        $content .= implode(",", $user_value) . "\n";
    }
    if (EC_CHARSET == 'utf-8') {
        $zip->add_file(ecs_iconv('UTF8', 'GB2312', $content), 'users_list.csv');
    } else {
        $zip->add_file($content, 'goods_list.csv');
    }
    header("Content-Disposition: attachment; filename=users_list.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:users_export.php

示例3: implode

                    $goods_value['goods_attr_item'] = '"' . $result_item . '"';
                    $goods_value['goods_attr_value'] = '"' . $result_value . '"';
                    $goods_value['num_shishou'] = '" "';
                    $goods_value['num_yingshou'] = '" "';
                    $content .= implode(",", $goods_value) . "\n";
                }
            } else {
                $goods_value['goods_attr_item'] = '" "';
                $goods_value['goods_attr_value'] = '" "';
                $goods_value['num_shishou'] = '" "';
                $goods_value['num_yingshou'] = '" "';
                $content .= implode(",", $goods_value) . "\n";
            }
        }
    }
    $zip->add_file(ecs_iconv(EC_CHARSET, 'GBK', $content), 'store_goods_list.csv');
    header("Content-Disposition: attachment; filename=store_goods_list.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
} elseif ($_REQUEST['act'] == 'batch') {
    $code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']);
    /* 取得要操作的商品编号 */
    $goods_id = !empty($_POST['checkboxes']) ? join(',', $_POST['checkboxes']) : 0;
    if (isset($_POST['type'])) {
        /* 放入回收站 */
        if ($_POST['type'] == 'trash') {
            /* 检查权限 */
            admin_priv('remove_back');
            update_goods($goods_id, 'is_delete', '1');
            /* 记录日志 */
            admin_log('', 'batch_trash', 'goods');
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:goods+-+副本.php

示例4: isset

        isset($goods_value['is_new']) && ($goods_value['is_new'] = $row['is_new']);
        isset($goods_value['is_hot']) && ($goods_value['is_hot'] = $row['is_hot']);
        isset($goods_value['is_on_sale']) && ($goods_value['is_on_sale'] = $row['is_on_sale']);
        isset($goods_value['is_alone_sale']) && ($goods_value['is_alone_sale'] = $row['is_alone_sale']);
        isset($goods_value['is_real']) && ($goods_value['is_real'] = $row['is_real']);
        $sql = "SELECT `attr_id`, `attr_value` FROM " . $ecs->table('goods_attr') . " WHERE `goods_id` = '" . $row['goods_id'] . "'";
        $query = $db->query($sql);
        while ($attr = $db->fetchRow($query)) {
            if (in_array($attr['attr_id'], $goods_fields)) {
                $goods_value[$attr['attr_id']] = '"' . $attr['attr_value'] . '"';
            }
        }
        $content .= implode(",", $goods_value) . "\n";
        /* 压缩图片 */
        if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) {
            $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']);
        }
    }
    $charset = empty($_POST['charset_custom']) ? 'UTF8' : trim($_POST['charset_custom']);
    $zip->add_file(ecs_iconv(EC_CHARSET, $charset, $content), 'goods_list.csv');
    header("Content-Disposition: attachment; filename=goods_list.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
} elseif ($_REQUEST['act'] == 'get_goods_list') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filters = $json->decode($_REQUEST['JSON']);
    $arr = get_goods_list($filters);
    $opt = array();
    foreach ($arr as $key => $val) {
        $opt[] = array('goods_id' => $val['goods_id'], 'goods_name' => $val['goods_name']);
开发者ID:noikiy,项目名称:mdwp,代码行数:31,代码来源:goods_export.php

示例5: array

             }
         }
     }
 }
 $sql = "SELECT g.goods_id, g.goods_name, g.shop_price, g.goods_number, g.goods_desc, g.goods_img " . " FROM " . $ecs->table('goods') . " AS g " . $where;
 $res = $db->query($sql);
 /* csv文件数组 */
 $goods_value = array('goods_name' => '', 'goods_class' => $goods_class, 'shop_class' => 0, 'new_level' => 0, 'province' => $shop_province, 'city' => $shop_city, 'sell_type' => '"b"', 'shop_price' => 0, 'add_price' => 0, 'goods_number' => 0, 'die_day' => 14, 'load_type' => 1, 'post_express' => $post_express, 'ems' => $ems, 'express' => $express, 'pay_type' => '', 'allow_alipay' => '', 'invoice' => 0, 'repair' => 0, 'resend' => 1, 'is_store' => 0, 'window' => 0, 'add_time' => '"1980-1-1  0:00:00"', 'story' => '', 'goods_desc' => '', 'goods_img' => '', 'goods_attr' => '', 'group_buy' => '', 'group_buy_num' => '', 'template' => 0, 'discount' => 0, 'modify_time' => '"2011-5-1  0:00:00"', 'upload_status' => 100, 'img_status' => 1, 'img_status' => '', 'rebate_proportion' => 0, 'new_goods_img' => '', 'video' => '', 'marketing_property_mix' => '', 'user_input_ID_numbers' => '', 'input_user_name_value' => '', 'sellers_code' => '', 'another_of_marketing_property' => '', 'charge_type' => '0', 'treasure_number' => '', 'ID_number' => '');
 $content = implode("\t", $_LANG['taobao46']) . "\n";
 while ($row = $db->fetchRow($res)) {
     /* 压缩图片 */
     if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) {
         $row['new_goods_img'] = preg_replace("/(^images\\/)+(.*)(.gif|.jpg|.jpeg|.png)\$/", "\${2}.tbi", $row['goods_img']);
         @copy(ROOT_PATH . $row['goods_img'], ROOT_PATH . "images\\/" . $row['new_goods_img']);
         if (is_file(ROOT_PATH . "images\\/" . $row['new_goods_img'])) {
             $zip->add_file(file_get_contents(ROOT_PATH . "images\\/" . $row['new_goods_img']), $row['new_goods_img']);
             unlink(ROOT_PATH . "images\\/" . $row['new_goods_img']);
         }
     }
     $goods_value['goods_name'] = '"' . $row['goods_name'] . '"';
     $goods_value['shop_price'] = $row['shop_price'];
     $goods_value['goods_number'] = $row['goods_number'];
     $goods_value['goods_desc'] = replace_special_char($row['goods_desc']);
     if (!empty($row['new_goods_img'])) {
         $row['new_goods_img'] = str_ireplace('/', '\\', $row['new_goods_img'], $row['new_goods_img']);
         $row['new_goods_img'] = str_ireplace('.tbi', '', $row['new_goods_img'], $row['new_goods_img']);
         $goods_value['new_goods_img'] = '"' . $row['new_goods_img'] . ':0:0:|;' . '"';
     }
     $content .= implode("\t", $goods_value) . "\n";
 }
 if (EC_CHARSET != 'utf-8') {
开发者ID:norain2050,项目名称:mhFault,代码行数:31,代码来源:goods_export.php

示例6: array

                    $ssql = "SELECT a.attr_name, ga.attr_value\n\t\t\t\t\t\t\tFROM " . $ecs->table('goods_attr') . " AS ga, " . $ecs->table('attribute') . " AS a\n\t\t\t\t\t\t\tWHERE ga.attr_id = a.attr_id\n\t\t\t\t\t\t\tAND ga.goods_id =" . $row['goods_id'] . "\n\t\t\t\t\t\t\tAND ga.goods_attr_id\n\t\t\t\t\t\t\tIN (" . $goods_attr . ")";
                    $rett = $db->query($ssql);
                    $value = array();
                    while ($r = $db->fetchRow($rett)) {
                        $value[] = $r['attr_name'] . ":" . $r['attr_value'];
                    }
                    $goods_value['goods_attr_item'] = '"' . implode('\\n', $value) . '"';
                }
                $goods_value['goods_attr_value'] = '"' . $goods_attr . '"';
                $goods_value['num_shishou'] = '"' . $row['store_number'] . '"';
                $goods_value['num_yingshou'] = '"' . $row['store_number'] . '"';
                $content .= implode(",", $goods_value) . "\n";
            }
        }
    }
    $zip->add_file(ecs_iconv(EC_CHARSET, 'GBK', $content), 'goods_getout.csv');
    header("Content-Disposition: attachment; filename=goods_getout.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
} elseif ($_REQUEST['act'] == 'edit_title') {
    check_authz_json('article_manage');
    $id = intval($_POST['id']);
    $title = json_str_iconv(trim($_POST['val']));
    /* 检查文章标题是否重复 */
    if ($exc->num("title", $title, $id) != 0) {
        make_json_error(sprintf($_LANG['title_exist'], $title));
    } else {
        if ($exc->edit("title = '{$title}'", $id)) {
            clear_cache_files();
            admin_log($title, 'edit', 'article');
            make_json_result(stripslashes($title));
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:store_inout_stock.php

示例7: isset

        isset($goods_value['is_new']) && ($goods_value['is_new'] = $row['is_new']);
        isset($goods_value['is_hot']) && ($goods_value['is_hot'] = $row['is_hot']);
        isset($goods_value['is_on_sale']) && ($goods_value['is_on_sale'] = $row['is_on_sale']);
        isset($goods_value['is_alone_sale']) && ($goods_value['is_alone_sale'] = $row['is_alone_sale']);
        isset($goods_value['is_real']) && ($goods_value['is_real'] = $row['is_real']);
        $sql = "SELECT `attr_id`, `attr_value` FROM " . $ecs->table('goods_attr') . " WHERE `goods_id` = '" . $row['goods_id'] . "'";
        $query = $db->query($sql);
        while ($attr = $db->fetchRow($query)) {
            if (in_array($attr['attr_id'], $goods_fields)) {
                $goods_value[$attr['attr_id']] = '"' . $attr['attr_value'] . '"';
            }
        }
        $content .= implode(",", $goods_value) . "\n";
        /* 压缩图片 */
        if (!empty($row['goods_img']) && is_file(ROOT_PATH . $row['goods_img'])) {
            $zip->add_file(file_get_contents(ROOT_PATH . $row['goods_img']), $row['goods_img']);
        }
    }
    $zip->add_file($content, 'goods_list.csv');
    header("Content-Disposition: attachment; filename=goods_list.zip");
    header("Content-Type: application/unknown");
    die($zip->file());
} elseif ($_REQUEST['act'] == 'get_goods_list') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filters = $json->decode($_REQUEST['JSON']);
    $arr = get_goods_list($filters);
    $opt = array();
    foreach ($arr as $key => $val) {
        $opt[] = array('goods_id' => $val['goods_id'], 'goods_name' => $val['goods_name']);
    }
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:goods_export.php


注:本文中的PHPZip::add_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。