PHP问题【急】【急】【急】【急】请大神帮忙 本帖最后由 sysmaze 于 2014-11-02 15:47:57 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的 KSeeing::assign 方法是怎么写的?一般的说$tpl->assign("show",'success'); 是将 'success' 赋予 $tpl 的 show 属性,通常会有一个载体所以可能是这样 $tpl->data['show'] = 'success';你的模板中是 <?php echo $show ?>所以 compile 方法中应是extract($this->data);include($comFile); 版主大人 compile这里面有个正则替换 我是故意在终极页面 写个变量$show = '111'; 看看能不能输出 正常的应该是$tpl->assign("show",'success');function assign($tpl_var,$value = null){ if($tpl_var!=''){ $this->vars[$tpl_var] = $value; } }现在的问题很纠结具体的情况是这样的 这是终极页面<?php require "system/system.php"; $tpl = new KSeeing(); $tpl->assign("show",'success'); //$show = '111'; include('templates/index.html'); //include('F:/AppServ/www/temp/tpl/com_index.html.php'); $tpl->compile('index.html');?>目前的终极页面可以正常输出success 这是没问题的 然后我稍加修改<?php require "system/system.php"; $show = '111'; $tpl->compile('index.html');?>这样index.html里的$show就没值了,问题来了!!!如果我把$tpl->compile('index.html');改成 include('templates/index.html');就好使了!!而$tpl->compile('index.html');得到的结果也是include('templates/index.html');或者是绝对路径 这样为啥就不好使了呢 目前表面问题看着像页面问题 ===============================================2楼终极页面有个没注释 修改下<?php require "system/system.php"; $tpl = new KSeeing(); $tpl->assign("show",'success'); //$show = '111'; //include('templates/index.html'); //include('F:/AppServ/www/temp/tpl/com_index.html.php'); $tpl->compile('index.html');?> 所以我要你给出 assign 方法的代码,这样才能有的放矢你在 compile 中 include 不行的元婴是 compile 中并没有变量 $show php读远程数据库的传输速度问题? PHP项目回顾 一个表单与超链接提交参数的问题 收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 php远程连接ORACLE时,undefined function ocilogon() 错误 获取某年某月之后的所有月份 PHP扩展几个问题 看CSDN的的迷茫 大学生反CNN网站被黑 创始人呼吁提供技术支援(PHP社群的兄弟们。这次轮到你们上了) 打印颜色表问题,代码分析 盼复!急! 为什么高负载情况下会出现session丢失?(网上找不到答案) 求一段php代码
$tpl->assign("show",'success');
是将 'success' 赋予 $tpl 的 show 属性,通常会有一个载体
所以可能是这样 $tpl->data['show'] = 'success';你的模板中是 <?php echo $show ?>
所以 compile 方法中应是
extract($this->data);
include($comFile);
版主大人 compile这里面有个正则替换 我是故意在终极页面 写个变量$show = '111'; 看看能不能输出 正常的应该是$tpl->assign("show",'success');function assign($tpl_var,$value = null){
if($tpl_var!=''){
$this->vars[$tpl_var] = $value;
}
}
现在的问题很纠结具体的情况是这样的 这是终极页面<?php
require "system/system.php";
$tpl = new KSeeing();
$tpl->assign("show",'success');
//$show = '111';
include('templates/index.html');
//include('F:/AppServ/www/temp/tpl/com_index.html.php');
$tpl->compile('index.html');
?>
目前的终极页面可以正常输出success 这是没问题的 然后我稍加修改<?php
require "system/system.php";
$show = '111';
$tpl->compile('index.html');
?>
这样index.html里的$show就没值了,问题来了!!!如果我把$tpl->compile('index.html');改成 include('templates/index.html');就好使了!!而$tpl->compile('index.html');得到的结果也是include('templates/index.html');或者是绝对路径 这样为啥就不好使了呢 目前表面问题看着像页面问题
2楼终极页面有个没注释 修改下<?php
require "system/system.php";
$tpl = new KSeeing();
$tpl->assign("show",'success');
//$show = '111';
//include('templates/index.html');
//include('F:/AppServ/www/temp/tpl/com_index.html.php');
$tpl->compile('index.html');
?>
你在 compile 中 include 不行的元婴是 compile 中并没有变量 $show