So at the top of php file that needs these resources, I use
Code: Select all
include("global.php");
Code: Select all
$read = $serial->readPort();
Line 104 is the call to the function and Line 370 is the actual read call to the classPHP Fatal error: Uncaught Error: Call to a member function readPort() on string in /var/www/controlserial.php:370
Stack trace:
#0 /var/www/controlserial.php(104): checkInput('11111')
#1 {main}
thrown in /var/www/controlserial.php on line 370
root@mypi:/var/www/#
I assume this error is thrown as the function doesn't know about that class? If so, can I simply also load the include within the function or is there a better way to do it?