复制代码 代码如下:
<?php
$jack = 1000;
?>
children.php 如下定义:
<?php
require("father.php");
$jack=123;
echo $jack."/n";
?>
复制代码 代码如下:
<?php
require("father.php");
function testJack(){
if(!isset($jack)){
echo '$jack is null'."/n";
}
}//testJack
testJack();
?>
复制代码 代码如下:
<?php
require("father.php");
function testJack(){
global $jack;
if(!isset($jack)){
echo '$jack is null'."/n";
}else{
echo '$jack is not null'."/n";
}
}//testJack
testJack();
?>
复制代码 代码如下:
<?php
require("father.php");
class JackTest{
public function testJack(){
if(!isset($jack)){
echo '$jack is null'."/n";
}else{
echo '$jack is not null'."/n";
}
}//testJack
}
$jackTest = new JackTest();
$jackTest->testJack();
?>
复制代码 代码如下:
<?php
$casefile = $_SERVER['argv'][1];
echo $casefile."/n";
require($casefile);
echo $jack."/n";
?>
新闻热点
疑难解答