下面还有一些详细的例子:
iconv — Convert string to requested character encoding
(PHP 4 >= 405, PHP 5)
mb_convert_encoding — Convert character encoding
(PHP 4 >= 406, PHP 5)
用法:
string mb_convert_encoding ( string str, string to_encoding [, mixed from_encoding] )
需要先enable mbstring 扩展库,在 phpini里将; extension=php_mbstringdll 前面的 ; 去掉
mb_convert_encoding 可以指定多种输入编码,它会根据内容自动识别,但是执行效率比iconv差太多;
1在根目录下找 categoryphp , 查找$arr[$row['goods_id']]['url']在底下添加以下代码:/ 已出售多少件 , 直接使用smarty 的insert 调用该方法 , 使用在goods_lbi文件中 /function insert_selectNum($arr){ $goods_id = $arr["goods_id"]; $sql = 'selectNULLM(ggoods_number),0)' 'FROM' $GLOBALS['ecs']-table('order_info')'AS o,' $GLOBALS['ecs']-table('order_goods') ' AS g ' "where oorder_id = gorder_id and ggoods_id = '$goods_id'" $ext; $sales_count_num = $GLOBALS['db']-getOne($sql); //echo $sql"==== 测试是否有数据输入"; return $sales_count_num;}2在themes\default\library 目录下找 goods_listlbi 查找修改前请注意备份源文件。========================================================================================== ecshop商品详细页显示已售商品数量和评论数量ecshop增加已售数量和评论数量很简单,步骤如下,原创文章转载请指明同盟者网络http://blogsinacomcn/tomener1在ecshop程序goodsphp页面最下面加入这两个函数function get_buy_sum($goods_id){ $sql = 'SELECT IFNULL(SUM(ggoods_number), 0) ' 'FROM ' $GLOBALS['ecs']-table('order_info') ' AS o, ' $GLOBALS['ecs']-table('order_goods') ' AS g ' "WHERE oorder_id = gorder_id " "AND oorder_status = '" OS_CONFIRMED "' " "AND oshipping_status " db_create_in(array(SS_SHIPPED, SS_RECEIVED)) " AND opay_status " db_create_in(array(PS_PAYED, PS_PAYING)) " AND ggoods_id = '$goods_id'"; return $GLOBALS['db']-getOne($sql);}function get_comment_num($goods_id) { $sql= "select count() from "$GLOBALS['ecs']-table('comment')" where id_value='"$goods_id"' AND status = 1"; return $GLOBALS['db']-getOne($sql);} 2在ecshop程序goodsphp中加入$smarty-assign('buy_num',get_buy_sum($goods_id));$smarty-assign('comment_num',get_comment_num($goods_id)); 在$smarty-display('goodsdwt', $cache_id);之前哈! 3ecshop中goodsdwt模板中加这个,大概在221行 !-- {if $buy_num} 已出售量-- li class="clearfix" strong累计售出:/strong{$buy_num} /dd /li !--{/if}-- !-- {if $comment_num} 评论数量-- li class="clearfix" strong评论数量:/stronga href="#comment"{$comment_num} /dd /li !--{/if}--
学习ecshop首先要先了解ecshop的基础配置,下面就说一下cls_ecshopphp文件 ECSHOP 基础类:function ECS($db_name, $prefix) 构造函数 @param string $ver 版本号 @return void
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)