0
Good afternoon, Folks.
I don’t know if my question makes much sense, but here goes.
For example, I have a class that has several functions, and I have my Index.php
Here we go, when I load the index and need to execute a method of a class, how do I instantiate the object of this class and execute the function according to a user action? For example, when the user clicks a button he will instantiate the Object and execute a certain function.
Ex:
Class:
<?php
class usuario{
private nome;
public function getNome(){
return $this->Nome;
}
}
?>
Index:
...
$usuario = new usuario();
$usuario->getNome();
...
Perfect, so it will only generate the object if the correct POST/GET exists?
– Tiago Silveira
Yes. In this example the object will only be created if get "action" exists and if the value of get "action" equals "user load".
– Antonio Alexandre