![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
我也是头一次接触它,做了个模板,但是一循环显示商品就抱错,而且只能显示一个不能循环,请大家帮我看看那里的错误啊?
[php]
<?
require('pre_inc.php');
$char_sql="select*from shop order by id desc";
$result=@mysql_db_query($db_name,$char_sql,$link_message);
$rows_number=@mysql_num_rows($result);
echo $rows_number;
for($i=0;$i<$rows_number;$i++){
$record=@mysql_fetch_object($result);
require('smarty/libs/smarty.class.php');
//生成$smarty实例
$smarty=new smarty;
//指定功能目录
$smarty->template_dir="smarty/templates";
$smarty->compile_dir="smarty/templates_c";
$smarty->config_dir="smarty/configs/";
$smarty->cache_dir="smarty/cache/";
//为模板变量赋值
$smarty->assign('tupian',$record->attachment);
$smarty->assign('jianjie',$record->productname);
$smarty->assign('name','机箱在线');
//显示模板
$smarty->display('zhanshi.tpl');
}
?>
[/php]
出现这个!
Fatal error: Cannot redeclare class smarty in f:\twins\php\jixiang\smarty\libs\smarty.class.php on line 61

