我不明白为什么我的变量没有设置多包含后。共享变量包含多个(php)
在header.php中,我有一个变量$ a在accueil.php
public function defaultShow(){
include(dirname(__FILE__)."/../view/app/header.php");
include(dirname(__FILE__)."/../view/app/accueil.php");
include(dirname(__FILE__)."/../view/app/footer.php");
}
$一个设置。它的作品
,但如果我的代码是
public function defaultShow(){
self::includeView("app/header");
self::includeView("app/accueil");
self::includeView("app/footer");
}
public static function includeView($view){
include dirname(__FILE__)."/../view/".$view.".php";
}
加载accueil.php而是$ a。本文件是空的。
在header.php中设置的所有变量是accueil.php
为什么是空的?
感谢答复
纪尧姆
全球$一个; $ a ='max'; –