smarty怎么获取cookie

smarty怎么获取cookie,第1张

:因为smarty的注册函数的返回值是用于显示的,所以我们如果要获取另一个的返回值,就需要用smarty的引用对象来进行赋值,然后在函数外再用这个值。1 你的函数,加个$smarty参数:function get_meat($params, $smarty)

<php

define('IN_JOBS', true);

require_once("/cc_include/commonphp");

require_once("/cc_include/pageclassphp");

require_once("/cc_include/page_functionphp");

require_once("/cc_include/Site_Configphp");

//加载smarty模板

$smarty = new Smarty();

$smarty->template_dir="/templates/default/";

$smarty->compile_dir="/templates_c/default/";

$smarty->cache_dir=CACHE_PATH;

$smarty->left_delimiter="{";

$smarty->right_delimiter="}";

$smarty->caching=false;

//开始跑首页信息

$Gonggao=News(1, 5);

//以上信息为公告和右侧的两个新闻

if (isset($_GET['sousuo'])) $searchname = $_GET['sousuo'];//得到搜索关键词

else if (isset($_POST['sousuo'])) $searchname = $_POST['sousuo'];

if(!isset($searchname))

{

echo "<script>locationhref='indexphp';</script>";

}

$typename=$_POST['type'];

$shijian=$_POST['rboname'];

$xitongshijian=date("Y-m-d");//获得系统当前时间

$jianyitian=date('Y-m-d H:i:s',strtotime("$a-1 day"));//减去一天时间

$jiansantian=date('Y-m-d',strtotime("$a-3 day"));//减去三天时间

$jianqitian=date('Y-m-d',strtotime("$a-7 day"));//减去7天时间

switch($typename)

{

case "职位名":

if($shijian=="")

{

$tiaojian="Shenhe=1 and Gzxx like '%"$searchname"%' order by Adddate desc";

}

else if($shijian=="近一天")

{

$tiaojian="Shenhe=1 and Gzxx like '%"$searchname"%' and Adddate between '"$jianyitian"' and '"$xitongshijian"' order by Adddate desc";

}

else if($shijian=="近三天")

{

$tiaojian="Shenhe=1 and Gzxx like '%"$searchname"%' and Adddate between '"$jiansantian"' and '"$xitongshijian"' order by Adddate desc";

}

else if($shijian=="近一星期")

{

$tiaojian="Shenhe=1 and Gzxx like '%"$searchname"%' and Adddate between '"$jianqitian"' and '"$xitongshijian"' order by Adddate desc";

}

break;

case "工作时间":

if($shijian=="")

{

$tiaojian="Shenhe=1 and Gzsj like '%"$searchname"%' order by Adddate desc";

}

else if($shijian=="近一天")

{

$tiaojian="Shenhe=1 and Gzsj like '%"$searchname"%' and Adddate between '"$jianyitian"' and '"$xitongshijian"' order by Adddate desc";

}

else if($shijian=="近三天")

{

$tiaojian="Shenhe=1 and Gzsj like '%"$searchname"%' and Adddate between '"$jiansantian"' and '"$xitongshijian"' order by Adddate desc";

}

else if($shijian=="近一星期")

{

$tiaojian="Shenhe=1 and Gzsj like '%"$searchname"%' and Adddate between '"$jianqitian"' and '"$xitongshijian"' order by Adddate desc";

}

break;

}

$perNumber=5; //每页显示的记录数

$page=$_GET['page']; //获得当前的页面值

$count=mysql_query("select count() from ejz_wor where "$tiaojian""); //获得记录总数

$rs=mysql_fetch_array($count);

$totalNumber=$rs[0];

$totalPage=ceil($totalNumber/$perNumber); //计算出总页数

if (!isset($page)) {

$page=1;

} //如果没有值,则赋值1

$startCount=($page-1)$perNumber; //分页开始,根据此方法计算出开始的记录

$sql="select Wor_id,Gzxx,Zprs,Gzsj,Gzyq,Daiyu,Adddate,jipin from ejz_wor where "$tiaojian" limit $startCount,$perNumber";

$result=mysql_query($sql);

while ($row=mysql_fetch_object($result))

{

>

<ul>

<li><div class="kf_xian" align="left">< echo "$row->Gzxx"> <a href="#" style="text-align:left">< echo "$row->Gzsj"></a></div></li>

<li>< echo "$row->Daiyu"></li>

<li>管理员回复:< echo "$row->Adddate"></li>

</ul>

<

}

if ($page != 1) { //页数不等于1

>

<php echo "总共"$totalPage"页,";>

<a href="wjphppage=<php echo $page - 1;>&sousuo=<php echo $searchname;>">上一页</a> <!--显示上一页-->

<php

}

for ($i=1;$i<=$totalPage;$i++) { //循环显示出页面

>

<a href="wjphppage=<php echo $i;>&sousuo=<php echo $searchname;>"><php echo $i ;></a>

<php

}

if ($page<$totalPage) { //如果page小于总页数,显示下一页链接

>

<a href="wjphppage=<php echo $page + 1;>&sousuo=<php echo $searchname;>">下一页</a>

<php

}

>

以上就是关于smarty怎么获取cookie全部的内容,包括:smarty怎么获取cookie、关于php多条件模糊查询后分页问题!、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/9548531.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存