php - Can't pass variable from routes to view in laravel 4 -
i'm trying learn laravel 4 , reading book called laravel: code bright
i'm trying pass array data routes view error
errorexception undefined variable: squirrel
codes these. same in book.
url localhost/test
routes.php
<?php route::get('/{squirrel}', function() { $data['squirrel'] = $squirrel; return view::make('simple', $data); }); ?>
simple.php
<!doctype html> <html lang="eng"> <head> <meta charset="utf-8"> <title>views!</title> </head> <body> <p>i wish <?php echo $squirrel; ?> squirrel!</p> </body> </html>
you have variable this:
<?php route::get('/{squirrel}', function($squirrel) { $data['squirrel'] = $squirrel; return view::make('simple', $data); });
Comments
Post a Comment