【发布时间】:2015-02-03 03:03:32
【问题描述】:
我有一个我想使用 Laravel 加载的 JSON 文件。我正在学习 Laravel,想知道正确的方法。我在公共文件夹中名为 json 的文件夹中有 JSON 文件。
在我的 routes.php 中,我有以下内容:
Route::get('/json/{jsonfile}', array(
'as' => 'load-json',
'uses' => 'JSONController@loadJSON'
));
在 JSONController 我有:
public function loadJSON($jsonfile) {
// not sure what to do here
return View::make('json.display')
->with('jsonfile', $jsonfile);
}
我的命名约定也可以吗?或者您有更好的建议吗?
【问题讨论】: