DelphiForPHP如何定义与使用全局变量
<?php
//Includes
require_once("vcl/vcl.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
//Class definition
$a=5;//定义全局变量
class Unit2 extends Page
{
public $Button2 = null;
public $Button1 = null;
function Button2Click($sender, $params)
{
global $a;//引用局变量
echo($a);//答案为什么不是6而是5,我如何才能得到6
}
function Button1Click($sender, $params)
{
global $a;//引用局变量
$a++;
echo($a);//答案=6
}
}
global $application;
global $Unit2;
//Creates the form
$Unit2=new Unit2($application);
//Read from resource file
$Unit2->loadResource(__FILE__);
//Shows the form
$Unit2->show();
?>
--------------------------------------------
问:如何改变全局变量$a的值,谢谢