暗黑神刹
(暗黑神刹)
新手上路

一般会员
UID 63452
精华
0
积分 49
帖子 52
金钱 49 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2005-2-28
状态 离线
|
[推荐阅读] 自己做了一个整站程序,请大家给点意见
+++++++++++++用SMTARY的++++++++++++++++++++++
<?
$st=microtime();
include(getcwd()."\smarty268\smarty.class.php");
$smt=new smarty;
$smt->templates_dir=getcwd()."/templates/";
$smt->compile_dir=getcwd()."/templates_c/";
$smt->catch_dir=getcwd()."/catch/";
$smt->config_rid=getcwd()."/configs/";
$smt->caching=true;
$conn=mysql_connect("localhost","root","123123");
mysql_select_db("test",$conn);
$rs=mysql_query("select * from ok",$conn);
$myarray=array();
while($val=mysql_fetch_array($rs)){
array_push($myarray,$val);
}
$smt->assign("rs",$myarray);
$ay=array("0","1","2","4","4");
$smt->assign("myarray",$ay);
$smt->assign("user",array("name"=>"mygym","sex"=>"男"));
$smt->caching=true;
$smt->clear_all_cache();
echo $smt->is_cached("index.tpl");
$smt->display("index.tpl");
echo microtime()-$st;
?>
'++++++++++++++++++不用SMARTY++++++++++++++++++++
<?
$st=microtime();
$conn=mysql_connect("localhost","root","123123");
mysql_select_db("test",$conn);
$rs=mysql_query("select * from ok",$conn);
?>
<body>
<table width="400" border="1" cellspacing="1" cellpadding="0">
<tr>
<td width="100">id</td>
<td width="100">name</td>
<td width="100">value</td>
<td width="100">ct</td>
</tr>
<? while($val=mysql_fetch_array($rs)){?>
<tr >
<td><? echo $val["id"]?></td>
<td><? echo $val["name"]?></td>
<td><? echo $val["value"]?></td>
<td><? echo $val["ct"]?></td>
</tr>
<? }?>
</table>
</body>
</html>
<?
mysql_free_result($rs);
mysql_close($conn);
echo microtime()-$st;?>
HTML页面代码是一样的,大伙帮我看看是不是我用的地方哪里不对了
|
|