PHP passthru Document Title Primer Tutorial

PHP passthru Document Title Primer Tutorial

PHP passthru Document Title Primer Tutorial

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_test.php‘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 mildly changed find_executable_and_go.php 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.

This entry was posted in eLearning, Event-Driven Programming, Operating System, Tutorials and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>