I am a rookie, and now I have a problem. In the file file1.php, how to use the namespace in file2.php? In the absence of a framework, use the MVC pattern.
<?php
//file1.php
namespace file1;
class File1
{
public function Test()
{
echo "file1.php";
}
}
?>
<?php
//file2.php
namespace file2;
class File2
{
public function Test2()
{
echo "file2.php";
}
}
now I want to use the Test method in file2.php. What should I do with a namespace? Does it have to be require_one file1.php? How is it implemented in the framework? Why can you write use file1;? directly in file2.php when you use it in other places?