当然到以后你也可以这么写<?php class A { function foo() { if (isset($this)) { echo '$this is defined ('; echo get_class($this); echo ")\n"; } else { echo "\$this is not defined.\n"; } } }class B { function bar() { A::foo(); } }$a = new A(); $a->foo(); A::foo(); $b = new B(); $b->bar(); B::bar(); ?>
http://www.codefans.net/sort/list_2_1.shtml
1、可以这么写test.php<?php
phpinfo();
?>
2、也可以这么写
test.php
<html>
<head>
</head>
<body>
<?php
function abc(){
if( true ){
$domain = "local var";
}
echo $domain;
}
abc();
?>
</body>
</html>再以后看看Zend 再搭建个环境。跑个例子。
class A
{
function foo()
{
if (isset($this)) {
echo '$this is defined (';
echo get_class($this);
echo ")\n";
} else {
echo "\$this is not defined.\n";
}
}
}class B
{
function bar()
{
A::foo();
}
}$a = new A();
$a->foo();
A::foo();
$b = new B();
$b->bar();
B::bar();
?>