怎么实现
然后 在 控制器中使用这个变量
<?php $foo = 'bar' ?>我的本意 是通过 控制器 里  $content = file_get_content(别人的网址) ;$content .="自己的一些html代码";然后 saveFile('保存为我的服务器上的文件',$content);我的本意 是通过 控制器 里  
$content = file_get_content(别人的网址) ;
$content .="自己的一些html代码";
然后 saveFile('保存为我的服务器上的文件',$content);
Blade::extend(function($value) {    return preg_replace('/\{\?(.+)\?\}/', '<?php ${1} ?>', $value);});\File::get('foo.blade.php')
| 恩,另外的办法就是拓展blade了 | 
| ?如何  从控制器 传变量 到 foo.blade.php | 
| 其实用{{ isset($foo) or bar }} 似乎也是可以赋值的 | 
| 像 views('blade.php')->with()这种形式 | 
| 传变量 | 
| 或者 发个 url  让我研究下 也行 | BinBoKami(512469492) 11:23:13 那个。。 |  | BinBoKami(512469492) 11:23:22你没有理解 balde。。 |  | BinBoKami(512469492) 11:23:29blade 他不是一个实例。 |  | BinBoKami(512469492) 11:23:33只能运行一次。 |  | BinBoKami(512469492) 11:23:42他没有办法保存成一个实例你调用 |  | 好吧 |  | BinBoKami(512469492) 11:23:52也就是说不管你赋值了多少变量 |  | 执行后变量的引用计数都会归零 |  | BinBoKami(512469492) 11:24:12只要你不在那个blade模板里调用。在外面调用这个blade他都会部件。 |  | BinBoKami(512469492) 11:24:14不见 |  | BinBoKami(512469492) 11:24:14是的 |  | BinBoKami(512469492) 11:24:31”执行完归零“ 这个说法最简单。 |  | 执行完销毁变量 | 
 | 
 
 
 
The idea is to cleanly separate logic from presentation. But in the case where it's more expedient to assign a variable in a template, here's a couple tricks.
You can always use the PHP tags.
<?php $var = 'test'; ?>
{{ $var }}
Or, you can use a Blade comment with a special syntax.
{{--*/ $var = 'test' /*--}}
{{ $var }}
This second method works because Blade comments get translated in the format below.
<?php /*COMMENT*/ ?>
Thus, the above variable assignment gets translated to the following PHP code.
<?php /**/ $var = 'test' /**/ ?>
See Using Comments in Blade Templates.
来自 http://laravel-recipes.com/recipes/256/assigning-a-variable-in-a-blade-template