4
Before the structure below:
- class view
- class controller
- new view()
- class controllerUsuario extends Controller
- public $usuario;
as access $usuario
from the "View"?
4
Before the structure below:
as access $usuario
from the "View"?
3
You can use namespace
to use classes in other files.
use RaizDaPasta\pastaDaClasse\Classe;
Inside your file where you do the use
install a new object and use the function you want
It worked for me Rafael, vlw!
0
I’m not sure what you want to do, but I believe it must be something like this:
<?php
class Apresentar
{
public function __construct(ControllerUsuario $usuario)
{
echo $usuario->getUsuario();
}
}
class ControllerUsuario
{
private $usuario = 'Fábio';
public function getUsuario()
{
return $this->usuario;
}
}
new Apresentar(new ControllerUsuario);
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
create a namespace and within the view
use nomeNameSpace
– RFL
Good Rafael, I solved with namespace. It worked, Valew!
– Thulyo Vinicius
I posted as a reply, please mark as resolved so that other users can find this solution.
– RFL