I have a class:
namespace Navi\View;
use Navi\Navi;
class View extends Base{
public function render(){
$test = 'This is a local variable!';
$obj = new Navi; //Working, ofcourse!
include 'file.php';
}
}
And in "file.php";
<?php
echo $test;
var_dump(new Navi); //Class Navi not found
Why the local $test variable pass to file.php, but Navi class isn't?
Ofcourse, if I use "use Navi\Navi" in "file.php" then code working. I don't understand why!
Any way to using Navi class that not using "use Navi\Navi"?
Please help me!
Thankyou!