{"id":67,"date":"2017-06-09T04:23:10","date_gmt":"2017-06-08T19:23:10","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=67"},"modified":"2022-03-23T03:01:23","modified_gmt":"2022-03-22T18:01:23","slug":"laravel-excel-%e3%81%ae-csv%e6%96%87%e5%ad%97%e5%8c%96%e3%81%91%e3%81%ab%e7%b5%b6%e6%9c%9b%e3%81%97%e3%81%9f%e3%81%ae%e3%81%a7%e3%83%91%e3%83%83%e3%82%b1%e3%83%bc%e3%82%b8%e3%82%92%e4%bd%9c%e3%81%a3","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=67","title":{"rendered":"Laravel-Excel \u306e CSV\u6587\u5b57\u5316\u3051\u306b\u7d76\u671b\u3057\u305f\u306e\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u3063\u305f\uff01"},"content":{"rendered":"<p>\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u4eba\u306a\u3089\u3088\u304f\u5b9f\u88c5\u3059\u308b\u3001\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u6a5f\u80fd\u3002<br \/>\n\u3053\u308c\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306a\u3069\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u9867\u5ba2\u30c7\u30fc\u30bf\u306a\u3069\u3092\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u3082\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u3092\u5b9f\u88c5\u3059\u308b\u969b\u306b Excel \u3084 CSV \u304c\u3088\u304f\u4f7f\u308f\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u308c\u306f\u4e16\u754c\u7684\u306b\u3082\u540c\u3058\u3067\u3042\u308b\u3088\u3046\u3067\u3001\u3059\u3067\u306b Laravel \u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u306f <a href=\"https:\/\/laravel-excel.com\/\">Laravel-Excel<\/a> \u3068\u3044\u3046\u6709\u540d\u306a\u3082\u306e\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u79c1\u81ea\u4fe1\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u306f\u3044\u3064\u3082\u304a\u4e16\u8a71\u306b\u306a\u3063\u3066\u3044\u3066\u3053\u308c\u307e\u3067\u3069\u308c\u3060\u3051\u306e\u6642\u9593\u3092\u77ed\u7e2e\u3055\u305b\u3066\u3082\u3089\u3063\u305f\u304b\u308f\u304b\u3089\u306a\u3044\u307b\u3069\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u4e00\u70b9\u3060\u3051\u554f\u984c\u70b9\u304c\u3001\u3001\u3001<\/p>\n<p>\u300cCSV\u3092\u4f5c\u308b\u306b\u306f UTF-8 \u4ee5\u5916\u3067\u306f\u4f5c\u308c\u306a\u3044\u300d<\/p>\n<p>\u3068\u3044\u3046\u3082\u306e\u3002<\/p>\n<p>\u305d\u306e\u6614\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u4f5c\u8005\u306b\u3053\u306e\u73fe\u8c61\u3092\u554f\u3044\u5408\u308f\u305b\u305f\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3084\u3089\u3053\u308c\u306f\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u305b\u3044\u3067\u306f\u306a\u304f\u3001PHPExcel \u3068\u3044\u3046\u5143\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u539f\u56e0\u3068\u306e\u3053\u3068\u3067\u3057\u305f\u3002<\/p>\n<p>\u3093\u30fc\u3001\u3053\u308c\u306f\u307e\u3044\u3063\u305f\u306a\u30fc\u3001\u3068\u601d\u3063\u305f\u306e\u304c\u6570\u5e74\u524d\u3067\u3057\u305f\u3002<br \/>\n\u305d\u3057\u3066\u3001\u300c\u3044\u3084\u3001\u305d\u306e\u3046\u3061\u5bfe\u5fdc\u3059\u308b\u3060\u308d\u3046\u300d<\/p>\n<p>\u3068\u601d\u3044\u3001\u3053\u308c\u307e\u3067\u306f\u30d0\u30ea\u30d0\u30ea\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066 CSV\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3092\u5b9f\u88c5\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4e45\u3057\u3076\u308a\u306b Laravel-Excel \u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u524d\u3068\u5168\u304f\u5909\u308f\u3089\u305a UTF-8 \u4ee5\u5916\u3067\u306f\u3046\u307e\u304f\u52d5\u4f5c\u3057\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u3082\u306f\u3084\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u983c\u308b\u306e\u306f\u3084\u3081\u3088\u3046\u3068\u6c7a\u5fc3\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u203b\u6b63\u78ba\u306b\u306f Excel \u306e\u4f5c\u6210\u3067\u306f\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3057\u307e\u3059m__m \u3067\u3059\uff01<br \/>\n\u203b\u3057\u304b\u3082\u3001\u4eca\u306e\u3053\u306e\u6642\u4ee3\u307e\u3060 Shift_JIS \u304c\u4f7f\u308f\u308c\u3066\u308b\u3053\u3068\u3082\u7d76\u671b\u3057\u307e\u3057\u305f\uff08\u7b11\uff09UTF-8\u3082\u5bfe\u5fdc\u3057\u305f\u3093\u3058\u3083\u306a\u304b\u3063\u305f\u3063\u3051\uff1f<\/p>\n<p>\u305d\u3053\u3067\u3001\u4eca\u56de Shift_JIS \u3067\u30a8\u30f3\u30b3\u30fc\u30c9\u3055\u308c\u305f CSV \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9 &amp; \u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b Lravel \u72ec\u81ea\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<br \/>\n\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306f\u4ee5\u4e0b\u306eGitHub\u30da\u30fc\u30b8\u304b\u3089\u884c\u3048\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/SUKOHI\/FluentCsv\">Sukohi\/FluentCsv<\/a><\/p>\n<p>\uff08\u4f7f\u3044\u65b9\uff09<\/p>\n<p>GitHub \u306e\u30da\u30fc\u30b8\u3067\u3082\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30c7\u30fc\u30bf\u3068\u6587\u5b57\u30b3\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u3066 download() or save() \u3092\u547c\u3076\u3060\u3051\u3067\uff2f\uff2b\u3067\u3059\u3002<\/p>\n<p>(Download)<\/p>\n<pre>$csv_data = [\r\n    ['\u30c7\u30fc\u30bf 1-1', '\u30c7\u30fc\u30bf 1-2', '\u30c7\u30fc\u30bf 1-3'],\r\n    ['\u30c7\u30fc\u30bf 2-1', '\u30c7\u30fc\u30bf 2-2', '\u30c7\u30fc\u30bf 2-3'],\r\n    ['\u30c7\u30fc\u30bf 3-1', '\u30c7\u30fc\u30bf 3-2', '\u30c7\u30fc\u30bf 3-3'],\r\n];\r\n$fluent = \\FluentCsv::setData($csv_data, 'SJIS-win');\r\n\r\nreturn $fluent-&gt;download('\u30c6\u30b9\u30c8.csv');<\/pre>\n<p>(Save)<\/p>\n<pre>$csv_data = [\r\n    ['\u30c7\u30fc\u30bf 1-1', '\u30c7\u30fc\u30bf 1-2', '\u30c7\u30fc\u30bf 1-3'],\r\n    ['\u30c7\u30fc\u30bf 2-1', '\u30c7\u30fc\u30bf 2-2', '\u30c7\u30fc\u30bf 2-3'],\r\n    ['\u30c7\u30fc\u30bf 3-1', '\u30c7\u30fc\u30bf 3-2', '\u30c7\u30fc\u30bf 3-3'],\r\n];\r\n$fluent = \\FluentCsv::setData($csv_data, 'SJIS-win');\r\n\r\nif($fluent-&gt;save(storage_path('app\/public\/test.csv'))) {\r\n\r\n    echo '\u30bb\u30fc\u30d6\u5b8c\u4e86\uff01';\r\n\r\n}<\/pre>\n<p>\u4f55\u304b\u306e\u304a\u5f79\u306b\u305f\u3066\u305f\u3089\u5149\u6804\u3067\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u4eba\u306a\u3089\u3088\u304f\u5b9f\u88c5\u3059\u308b\u3001\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u6a5f\u80fd\u3002 \u3053\u308c\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306a\u3069\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u9867\u5ba2\u30c7\u30fc\u30bf\u306a\u3069\u3092\u30ed\u30fc\u30ab\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u3082\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u3092\u5b9f\u88c5 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=67\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel-Excel \u306e CSV\u6587\u5b57\u5316\u3051\u306b\u7d76\u671b\u3057\u305f\u306e\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u3063\u305f\uff01&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":71,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[9],"class_list":["post-67","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-csv"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67"}],"version-history":[{"count":6,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":10260,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/67\/revisions\/10260"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/71"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}