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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -