Bonsoir,

Accueil.php :
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
namespace PasDePanique\view;
 
class Accueil {
private function  disp_a_propos(){
    ?>
    <section class="propos">
    <!-- code html -->
    </section>
<?php
}
 
public function invoke()
{
    disp_a_propos();
 
}
}
?>
et dans routing.php on instancie la classe puis appelle sa méthode publique :
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
<?php 
declare(strict_types=1);
use PasDePanique\view\Accueil;
 
if (!(isset($_GET['action']))) {
    $ctrl = new Accueil;
    $ctrl->invoke();
}
Le message d'erreur est :
Fatal error: Uncaught Error: Call to undefined function PasDePanique\view\disp_a_propos() in C:\projets\arnaudpoo\view\Accueil.php on line 52
Est-ce que j'appelle mal la méthode privée ligne 15 de Accueil.php ou voyez-vous un autre problème ?