ReactPHP for Beginners by Sergey Zhuk
Author:Sergey Zhuk [Zhuk, Sergey]
Language: eng
Format: epub
Publisher: leanpub.com
Published: 2018-08-04T23:00:00+00:00
Here is the complete version of the handler for the /list route:
// routes.php '/list' => function ( ServerRequestInterface $request, LoopInterface $loop ) { $listFiles = new Process('ls uploads', __DIR__); $listFiles->start($loop); $renderPage = new Process('php pages/list.php', __DIR__); $renderPage->start($loop); $listFiles->stdout->pipe($renderPage->stdin); return new Response( 200, ['Content-Type' => 'text/html'], $renderPage->stdout ); },
Rendering PHP template
Fine. Handler is done and we can continue with a PHP template. Create pages/list.php file with the following contents:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>List of uploads</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.cs\ s"> </head> <body> <div class="container"> <div class="row"> <div class="col-sm-12"> <h1>List of uploads</h1> </div> <ul class="list-group col-sm-6"> <?php foreach($uploads as $upload): ?> <li class="list-group-item"> <?php echo $upload ?> </li> <?php endforeach; ?> </ul> </div> </div> </body> </html>
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27094)
Hello! Python by Anthony Briggs(25950)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25285)
Kotlin in Action by Dmitry Jemerov(24393)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23591)
Dependency Injection in .NET by Mark Seemann(23313)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21944)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20848)
Grails in Action by Glen Smith Peter Ledbrook(19869)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17073)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16833)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14464)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12584)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11865)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10650)
Hit Refresh by Satya Nadella(9238)
The Kubernetes Operator Framework Book by Michael Dame(8588)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8446)
Robo-Advisor with Python by Aki Ranin(8387)