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

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -