send.php<?php
require("./class/smarty.php");
require("./class/mysql.php");
include("./class/category.php");
require("./check_login.php");$tree=new tree();
$tree->data();
$tree_info=$tree->get_all_tree(0);//分类信息$smarty->assign("top","top.html");
$smarty->assign("islogin",$islogin);
$smarty->assign("user",$user_name);$smarty->assign("tree_info",$tree_info);$smarty->display("send.html");?>check_login.php<?php
require("./class/session.php");
include("./class/show.php");$session=new session();
$show=new show();
$now_user=$session->get_session_name();
if($now_user=='')
{
$show->success("test");
}
else
{};
?>
./class/show.php<?php
include("./smarty.php");class show
{
public $message;
public $status;
public $return_time=2;
public function success($message)
{
echo 333;
$smarty->assign("message",$message);
echo 555;
echo "<meta http-equiv=refresh content='$this->return_time; url=index.php'>";
$smarty->display("success.html");
}
}
?>
最后打开send.php,333打印出来了,555没打印出来
我就是想做一个调用显示“操作成功”,“操作失败”这样的类而已~~~能告诉我一般的这样是怎么写的或者给一个smarty的demo我吗?万分感谢
require("./class/smarty.php");
require("./class/mysql.php");
include("./class/category.php");
require("./check_login.php");$tree=new tree();
$tree->data();
$tree_info=$tree->get_all_tree(0);//分类信息$smarty->assign("top","top.html");
$smarty->assign("islogin",$islogin);
$smarty->assign("user",$user_name);$smarty->assign("tree_info",$tree_info);$smarty->display("send.html");?>check_login.php<?php
require("./class/session.php");
include("./class/show.php");$session=new session();
$show=new show();
$now_user=$session->get_session_name();
if($now_user=='')
{
$show->success("test");
}
else
{};
?>
./class/show.php<?php
include("./smarty.php");class show
{
public $message;
public $status;
public $return_time=2;
public function success($message)
{
echo 333;
$smarty->assign("message",$message);
echo 555;
echo "<meta http-equiv=refresh content='$this->return_time; url=index.php'>";
$smarty->display("success.html");
}
}
?>
最后打开send.php,333打印出来了,555没打印出来
我就是想做一个调用显示“操作成功”,“操作失败”这样的类而已~~~能告诉我一般的这样是怎么写的或者给一个smarty的demo我吗?万分感谢
是存在的~~~我试过在涉及到的所有文件夹都放上smarty.php结果还是一样~
是存在的~~~我试过在涉及到的所有文件夹都放上smarty.php结果还是一样~
那你还是自己断点调一下吧,我没做测试,看也看不出来什么。或者你先把 $smarty 打印出来然后再调用assign,之后再打印一点东西,然后在调用display然后再打印一点东西看看,先确定问题出在那里,然后再寻找解决办法
{
echo 333;
$smarty->assign("message",$message);
echo 555;
echo "<meta http-equiv=refresh content='$this->return_time; url=index.php'>";
$smarty->display("success.html");
}
这个 $smarty 在哪里实例化的?
使用全局变量不需要声明吗?
./class/smarty.php<?php
require('./libs/Smarty.class.php');
$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = false;
$smarty->caching = false;
$smarty->cache_lifetime = 120;
?>