{"id":434,"date":"2026-06-30T10:54:32","date_gmt":"2026-06-30T01:54:32","guid":{"rendered":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/434"},"modified":"2026-07-01T08:36:04","modified_gmt":"2026-06-30T23:36:04","slug":"codeigniter%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/www.marchboy.xyz\/wordpress\/archives\/434","title":{"rendered":"codeigniter\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>CodeIgniter\u306f\u8efd\u91cf\u304b\u3064\u9ad8\u901f\u306aPHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u521d\u5fc3\u8005\u3067\u3082\u6bd4\u8f03\u7684\u77ed\u3044\u5b66\u7fd2\u6642\u9593\u3067 MVC \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3092\u5229\u7528\u3057\u305f\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806<\/h2>\n<p>\u516c\u5f0f\u30b5\u30a4\u30c8\u304b\u3089\u6700\u65b0\u7248\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3001Web\u30b5\u30fc\u30d0\u306e\u516c\u958b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u5c55\u958b\u3057\u307e\u3059\u3002<br \/>\nComposer \u3092\u4f7f\u3046\u5834\u5408\u306f <code>composer create-project codeigniter4\/appstarter \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d<\/code> \u3068\u5b9f\u884c\u3059\u308c\u3070\u81ea\u52d5\u3067\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u57fa\u672c\u7684\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210<\/h2>\n<p>\u4e3b\u8981\u306a\u30d5\u30a9\u30eb\u30c0\u306f <code>app<\/code>\uff08\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fb\u30e2\u30c7\u30eb\u30fb\u30d3\u30e5\u30fc\uff09\u3001<code>public<\/code>\uff08\u30a8\u30f3\u30c8\u30ea\u30dd\u30a4\u30f3\u30c8\uff09\u3001<code>writable<\/code>\uff08\u30ad\u30e3\u30c3\u30b7\u30e5\u30fb\u30ed\u30b0\uff09\u3067\u3059\u3002<\/p>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u4f5c\u6210<\/h2>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306f <code>app\/Controllers<\/code> \u306b PHP \u30af\u30e9\u30b9\u3068\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002\u4f8b:<br \/>\n<code>namespace App\\Controllers;<\/code><br \/>\n<code>class Hello extends BaseController<\/code><br \/>\n<code>{<\/code><br \/>\n<code>    public function index()<\/code><br \/>\n<code>    {<\/code><br \/>\n<code>        return view('hello');<\/code><br \/>\n<code>    }<\/code><br \/>\n<code>}<\/code><\/p>\n<h2>\u30d3\u30e5\u30fc\u306e\u4f5c\u6210<\/h2>\n<p>\u30d3\u30e5\u30fc\u306f <code>app\/Views<\/code> \u306b\u914d\u7f6e\u3057\u3001HTML \u3068 PHP \u306e\u6df7\u5728\u304c\u53ef\u80fd\u3067\u3059\u3002\u5148\u307b\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067 <code>return view('hello');<\/code> \u3068\u547c\u3073\u51fa\u3059\u3053\u3068\u3067 <code>app\/Views\/hello.php<\/code> \u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>\u30e2\u30c7\u30eb\u306e\u4f5c\u6210<\/h2>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u306f\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u3067\u884c\u3044\u307e\u3059\u3002<code>app\/Models<\/code> \u306b\u4f5c\u6210\u3057\u3001<code>extends CodeIgniter\\Model<\/code> \u3092\u7d99\u627f\u3057\u307e\u3059\u3002<br \/>\n\u4e3b\u306a\u30d7\u30ed\u30d1\u30c6\u30a3\u306f <code>protected $table<\/code>\uff08\u30c6\u30fc\u30d6\u30eb\u540d\uff09\u3084 <code>protected $primaryKey<\/code>\uff08\u4e3b\u30ad\u30fc\uff09\u3067\u3059\u3002<\/p>\n<h2>\u30c7\u30d0\u30c3\u30b0\u3068\u30c6\u30b9\u30c8<\/h2>\n<p>\u958b\u767a\u74b0\u5883\u3067\u306f <code>.env<\/code> \u30d5\u30a1\u30a4\u30eb\u306e <code>CI_ENVIRONMENT = development<\/code> \u3092\u8a2d\u5b9a\u3057\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8a73\u7d30\u306b\u8868\u793a\u3055\u305b\u307e\u3059\u3002<br \/>\n\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306f <code>tests<\/code> \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b PHPUnit \u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u914d\u7f6e\u3057\u3001<code>php spark test<\/code> \u3067\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>CodeIgniter\u306f\u30b7\u30f3\u30d7\u30eb\u306a\u69cb\u9020\u3068\u8c4a\u5bcc\u306a\u30d8\u30eb\u30d1\u30fc\u95a2\u6570\u306b\u3088\u308a\u3001\u8fc5\u901f\u306b\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u672c\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304b\u3089\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fb\u30d3\u30e5\u30fc\u30fb\u30e2\u30c7\u30eb\u306e\u57fa\u672c\u7684\u306a\u4f5c\u308a\u65b9\u3092\u53c2\u8003\u306b\u3001\u305c\u3072\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u6d3b\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b CodeIgniter\u306f\u8efd\u91cf\u304b\u3064\u9ad8\u901f\u306aPHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002\u521d\u5fc3\u8005\u3067\u3082\u6bd4\u8f03\u7684\u77ed\u3044\u5b66\u7fd2\u6642\u9593\u3067 MVC \u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3092\u5229\u7528\u3057\u305f\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806 \u516c\u5f0f\u30b5\u30a4\u30c8\u304b\u3089\u6700\u65b0\u7248\u3092\u30c0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-434","post","type-post","status-publish","format-standard","hentry","category-codeigniter"],"_links":{"self":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/comments?post=434"}],"version-history":[{"count":2,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/434\/revisions"}],"predecessor-version":[{"id":436,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/posts\/434\/revisions\/436"}],"wp:attachment":[{"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/media?parent=434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/categories?post=434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.marchboy.xyz\/wordpress\/wp-json\/wp\/v2\/tags?post=434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}