Autoloading does not recognize use command , after a Ubmit?

Asked

Viewed 38 times

2

<?php
namespace App\Controller;


class Action {
    
    function mostrarDado(){
        echo "Mostrando Dados....";
    }
    
}
<?php
$paramUser = $_GET['usuario'];
$paramSenha = $_GET['senha'];
var_dump($paramUser);
var_dump($paramSenha);

$act = new App\Controller\Action();
var_dump($act->mostrarDado());

?>
<?php

require_once 'vendor/autoload.php';
?>

<html>
<form action="App/Script/Script.php" method="get">
<input name="usuario">
<input name="senha">
<button type="submit"></button>
</form>
</html>

  • 1

    Hello @Alan welcome to Stackoverflow, please add snippets of your code so we can find the problems.

  • 1

    Hello @Lucasduete Thank you!! , posted the above code, I have this doubt regarding how php treats submission formulations, it is certain that I get the get , post , but autoload does not load the instantiation after a submission. Use does nothing for what I’ve been researching, but autoload , does not recognize after a Ubmit , only if I redeclare in the later file. How do I make it recognize even after Submit? without redirecting, by foward itself?

  • I’m using Autopload for a project without a framework , only for testing. I’m doing the autoload propagation, from index.php, then to script.php and finally to action.php, with this autoload propagation, without Submit occurs the normal namespace recognition, so when giving a Submit from the index loses-if the require statement for vendor/autload.php.

  • With Submit : console: PHP Fatal error: Uncaught Error: Class 'App Controller Action

  • Is it correct to say that autoload depends exclusively on my index.php, and that my entire application revolves around a route configuration from or linked to it ? because in my understanding I can take over the request interception for routing, but without losing my link with autoload?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.