Home >Backend Development >PHP Tutorial >PHP global class instance introduction
<?phpclass hello{ function say() { echo "hello world !"; } }
<?phprequire_once('test1.php'); require_once('test2.php'); require_once('hello.php'); use space\test1\test;use space\test2\test as test2;$test1 = new test();$test2 = new test2(); $hello = new \hello();$test1->say(); $test2->say(); $hello->say();
The above is the detailed content of PHP global class instance introduction. For more information, please follow other related articles on the PHP Chinese website!