utilisation abrégée de PhpEcho en cas d'affichage de code PHP
Bonjour,
je voudrais savoir si on peut étendre la forme courte d'utilisation de PhpEcho,
comme ça :
Code:
1 2 3
| $body = new PhpEcho();
$body->setCode('<p>This file is not a .csv file</p>');
echo new PhpEcho([DIR_ROOT, 'view Layout.php'], ['body' => $body]); |
au cas où l'on doit insérer du code PHP dans le texte à afficher, du genre :
Code:
1 2 3
| $body = new PhpEcho();
$body->setCode('<p>The file '.$file_name.' is not a .csv file</p>');
echo new PhpEcho([DIR_ROOT, 'view Layout.php'], ['body' => $body]); |
ou bien est-on obligé de passer par un deuxième fichier ?