PHP – passthru with output buffering
將 passthru 輸出內容存在變數中:
1 2 3 |
ob_start(); passthru('php artisan', $return); $return = ob_get_clean(); |
將 passthru 輸出內容存在變數中:
1 2 3 |
ob_start(); passthru('php artisan', $return); $return = ob_get_clean(); |
1 2 |
$view = View::make('layouts.scaffold'); $view->getEnvironment()->inject('main',$return); |
layouts/scaffold.blade.php:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Scaffold</title> <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"> <style> table form { margin-bottom: 0; } form ul { margin-left: 0; list-style: none; } .error { color: red; font-style: italic; } body { padding-top: 20px; } </style> </head> <body> <div class="container"> @if (Session::has('message')) <div class="flash alert"> {{ Session::get('message') }} </div> @endif @yield('main') </div> </body> </html> |
修改 app/config/mail.php
:
smtp.gmail.com
465
ssl
1 2 3 4 5 6 7 8 9 10 |
<?php return array( 'driver' => 'smtp', 'host' => 'smtp.gmail.com', 'port' => 465, 'encryption' => 'ssl', ); |
Test:
1 2 3 4 5 6 7 8 |
Route::get('/MailTest', function() { $data['name'] = 'Starck Lin'; Mail::send('emails.welcome', $data, function($message) { }); }); |