KMa*_*ley 17 json file-get-contents laravel
我现在正在使用Laravel-5,我刚刚创建了一个JSON名为test(test.json)的文件.我的问题是:
这是我尝试过的,这显然是错误的:
$string = file_get_contents("../json/test.json");
$json_file = json_decode($string, true);
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助!
Jil*_*mas 32
您可以将它存储在Laravel的存储文件夹中:
$path = storage_path() . "/json/${filename}.json"; // ie: /var/www/laravel/app/storage/json/filename.json
$json = json_decode(file_get_contents($path), true);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20977 次 |
| 最近记录: |