码迷,mamicode.com
首页 > 其他好文 > 详细

tp_shop解读1

时间:2016-12-16 01:42:49      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:function   control   程序   man   rand   ica   home   ack   rac   

由于想弄一个商城,因此研究了一下tp_shop,这个据说能完成几乎所有的功能。

考虑到原有的例子过于复杂,因此把所有相关的数据都删除了,结果上来就出错了,查了两天,大致弄清楚了状况。

技术分享

关于错误的原因

在此文件中:Application/Home/Controller/ChannelController.class.php

运行完

SELECT `id`,`parent_cat_id`,`logo`,`is_hot` FROM `kj_brand` WHERE ( 
parent_cat_id>0 )

后,

然后运行至:

select goods_id,cat_id,goods_name,shop_price,market_price from kj_goods where 
is_on_sale=1 and cat_id in ()

出错,原因是

$sub_id_str=()

然后

$sql = "select goods_id,cat_id,goods_name,shop_price,market_price from 
__PREFIX__goods where is_on_sale=1 and cat_id in $sub_id_str ";

这句调用就出错了

 

另外,提一下日志体系,此日志使用thinkphp的日志体系,可参考:

http://document.thinkphp.cn/manual_3_2.html#log

由于系统封装了日志库,在functions.php中,函数为trace(),因此可在程序的任意地方打印日志,如在

Application/Home/Controller/IndexController.class.php的index()中调用如下代码:

trace(‘[ ‘.index.‘ ] --START--进入首页‘,‘‘,‘INFO‘);
则系统进入首页后会在日志文件中产生如下日志:
INFO: [ index ] --START--进入首页
 

tp_shop解读1

标签:function   control   程序   man   rand   ica   home   ack   rac   

原文地址:http://www.cnblogs.com/luhouxiang/p/6185358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!