21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
use test1;
function test2()
{
echo __FUNCTION__;
}
echo test1();
namespace test1;
include 'test1.php';
function test2()
{
echo __FUNCTION__;
}
echo test();
include 'test1.php';
//use test1;
function test2()
{
echo __FUNCTION__;
}
echo test1\test();
include "test1.php";
use test1\test;
$t = new test();
echo $t->test1();
或者include "test1.php";
use test1\test as test2;
$t = new test2();
echo $t->test1();
或者include "test1.php";
$t = new test1\test();
echo $t->test1();
<?php
namespace test1;
class test
{
function test1()
{
echo 'fun:'.__FUNCTION__;
}
}
test2.php:
<?php
use test1;
include "test1.php";
$t=new test();
echo $t->test1();
感觉use还是没有起作用。