vendredi 9 juillet 2021

if statement for use statement in php [duplicate]

I need help to improve an if statement on an use statement. This is my code :

require __DIR__ . '/../../autoload.php';
use Mike42\Escpos\Printer;
if ($type == 'LAN') use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
if ($type == 'USB') use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;

but there are errors in last 2 lines. I don't understand why.

I think there is another way to do this. Please help me. Thank you

Aucun commentaire:

Enregistrer un commentaire