We are a bit in awe of the PHP โpassthruโ function (again, โyou had to be thereโ) as that direct conduit to output from an underlying operating system command. Weโve been in such awe, we have only ever dared use it on its own on a PHP codeline. But yesterdayโs Xcode Command Line Project GUI Executable Tutorial got us wondering if we could tweak improvements, so that we can improve on โฆ
- a โpassthruโ inspired webpage content just containing that underlying operating system command content โฆ but which misses out on defining a webpage โdocument.titleโ which is shown (usefully in a web browser tabbing situation) on that webpageโs web browser tab of use โฆ but what if we can have โฆ
- a โpassthruโ inspired webpage content displays that underlying operating system command content while also establishing a relevant and useful โdocument.titleโ to display on that webpageโs web browser tab of use
? Happily, yet it being a tad awkward and kludgy, itโs possible, and we wrote a PHP โproof of conceptโ passthru_testphpโs web application with a defined document.title (versus web application without a defined document.title) source โฆ
<?php
// passthru_test.php
// RJM Programming
// April, 2022
if (isset($_GET['justpassthru'])) {
passthru('echo "PHP passthru content with no HTML embellishment"');
} else {
echo "<html><head><title>PHP passthru content has HTML document.title embellishment</title></head><body><pre>" . passthru('echo "PHP passthru content has HTML document.title embellishment"') . "</pre></body></html>";
}
exit;
?>
โฆ can have us improving yesterdayโs PHP code find_executable_and_go.php web applicationโs mildlychanged find_executable_and_gophp which we, yet again, want you to download to (the Document Root of) a macOS MAMP local Apache/PHP/MySql web server environment, โIntranet styleโ.
If this was interesting you may be interested in this too.