<?php //phpinfo(); @ini_set('display_errors', '1'); error_reporting(E_ALL); spl_autoload_register('myautoload'); function myautoload($classname) { include 'cls.php'; } class testa { function f() { echo 'aaa'; exit; include 'cls.php'; $a = new testb(); echo $a->f(); } function f2() { $a = new testb(); echo $a->f(); } } $c = new testa(); $c->f2();
<?php header('Content-type: text/plain'); require_once 'App/lib.php'; include_once './interface/test.php'; use App\lib as m; abstract class test implements header { public abstract function testb(); } class testa extends test { public function testb() { echo 'this is is testb'; } public function is_login() { $a = array('1', '2'); return $a; } } $a = new testa(); //m\MYCONST; $x = m\MyFunction($a->is_login()); //m\MyClass::WhoAmI("hi"); print_r($x);