2
的index.php
require_once('smarty/Smarty.class.php');
$Smarty = new Smarty();
function do_something() {
global $Smarty;
echo "where is smarty?"
var_dump($Smarty);
$ObjSmarty->assign("teams_list", $teams_list);
}
get_active_teams();
没有转储和错误分配...
require_once('smarty/Smarty.class.php');
$Smarty = new Smarty();
function do_something() {
global $Smarty;
echo "where is smarty?"
var_dump($GLOBALS);
var_dump($GLOBALS["Smarty"]);
}
get_active_teams();
转储全局的显示Smarty的,当我倾倒$全局[ “智者”]没有。这是怎么回事。
我没有课是这个问题吗?
如何在不使用声明类的情况下分配给加载的php内部smarty对象?
您在第一个例子中将其称为$ Smarty和$ ObjSmarty - 是错误还是实际存在于代码中? – 2012-03-22 09:07:44