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