{"id":5521,"date":"2024-05-10T13:04:55","date_gmt":"2024-05-10T04:04:55","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=5521"},"modified":"2024-03-19T13:31:14","modified_gmt":"2024-03-19T04:31:14","slug":"post-5521","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/5521","title":{"rendered":"PHP\u3067\u7c21\u5358\u306b\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u300cPHP Calendar\u300d\u306e\u5229\u7528\u65b9\u6cd5"},"content":{"rendered":"<p>PHP\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u63cf\u5199\u3057\u305f\u3044\u3068\u3044\u3046\u3053\u3068\u304c\u305f\u307e\u306b\u3042\u308b\u3002\u4eca\u307e\u3067\u30d0\u30cb\u30e9PHP\u3067\u66f8\u3044\u3066\u3044\u305f\u304c\u300c\u6708\u66dc\u65e5\u59cb\u307e\u308a or \u65e5\u66dc\u65e5\u59cb\u307e\u308a\u300d\u300c\uff11\u9031\u76ee\u3068\u6700\u7d42\u9031\u306e\u7a7a\u30ab\u30e9\u30e0\u306e\u8a08\u7b97\u300d\u7b49\u304c\u9762\u5012\u3002\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u4f55\u3068\u304b\u306a\u3089\u306a\u3044\u304b\u8abf\u3079\u305f\u3068\u3053\u308d\u300cPHP Calendar(benhall14 \/ php-calendar)\u300d\u304c\u826f\u3055\u305d\u3046\u3002\u4ee5\u4e0b\u306b\u5b9f\u88c5\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u3084\u308a\u305f\u3044\u3053\u3068<\/h2>\n<ul>\n<li>PHP\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u3092table\u30bf\u30b0\u3067\u63cf\u5199\u3057\u305f\u3044<\/li>\n<li>\u5e74\u6708\u3092\u6307\u5b9a\u3059\u308b\u3068\u5f53\u8a72\u6708\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u8868\u793a<\/li>\n<li>CSS\u306b\u95a2\u3057\u3066\u306f\u672a\u8a2d\u5b9a\u306b\u3057\u305f\u3044<\/li>\n<li>\u65e5\u672c\u8a9e\u8868\u8a18<\/li>\n<li>\u6708\u66dc\u65e5\u59cb\u307e\u308a\u306b\u3057\u305f\u3044<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>PHP Calendar(benhall14 \/ php-calendar)<\/h2>\n<h3>\u516c\u5f0f\u30b5\u30a4\u30c8<\/h3>\n<p><a href=\"https:\/\/conobe.co.uk\/projects\/php-calendar\/\" target=\"_blank\" rel=\"noopener\">https:\/\/conobe.co.uk\/projects\/php-calendar\/<\/a><\/p>\n<h3>GitHub<\/h3>\n<p><a href=\"https:\/\/github.com\/benhall14\/php-calendar\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/benhall14\/php-calendar<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-3\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/span><\/h2>\n<h3><span id=\"composer\">composer\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5834\u5408<\/span><\/h3>\n<p>\u30b5\u30fc\u30d0\u306bSSH\u63a5\u7d9a\u3057\u4ee5\u4e0b\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">composer require benhall14\/php-calendar<\/pre>\n<h3><span id=\"i-5\">\u624b\u52d5\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5834\u5408<\/span><\/h3>\n<p><a href=\"https:\/\/github.com\/benhall14\/php-calendar\/blob\/master\/src\/phpCalendar\/Calendar.php\" target=\"_blank\" rel=\"noopener\">\u516c\u5f0f\u30b5\u30a4\u30c8\u304b\u3089Calendar.php\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\u3057\u3001\u9069\u5f53\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u3002\u4eca\u56de\u306f\u3053\u3061\u3089\u306e\u65b9\u6cd5\u3092\u53d6\u3063\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><span id=\"i-6\">\u5229\u7528\u65b9\u6cd5<\/span><\/h2>\n<h3>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?php\r\nrequire 'src\/phpCalendar\/Calendar.php';\r\n\r\nuse benhall14\\phpCalendar\\Calendar as Calendar;\r\n\r\n$calendar = new Calendar;\r\n$calendar-&gt;stylesheet(false);\r\n\r\n\/\/\u66dc\u65e5\u306e\u65e5\u672c\u8a9e\u5316\r\n$calendar-&gt;setDays([\r\n    'sunday' =&gt; [\r\n        'initials' =&gt; '\u65e5',\r\n        'full' =&gt; '\u65e5',\r\n    ],\r\n    'monday' =&gt; [\r\n        'initials' =&gt; '\u6708',\r\n        'full' =&gt; '\u6708',\r\n    ],\r\n    'tuesday' =&gt; [\r\n        'initials' =&gt; '\u706b',\r\n        'full' =&gt; '\u706b',\r\n    ],\r\n    'wednesday' =&gt; [\r\n        'initials' =&gt; '\u6c34',\r\n        'full' =&gt; '\u6c34',\r\n    ],\r\n    'thursday' =&gt; [\r\n        'initials' =&gt; '\u6728',\r\n        'full' =&gt; '\u6728',\r\n    ],\r\n    'friday' =&gt; [\r\n        'initials' =&gt; '\u91d1',\r\n        'full' =&gt; '\u91d1',\r\n    ],\r\n    'saturday' =&gt; [\r\n        'initials' =&gt; '\u571f',\r\n        'full' =&gt; '\u571f',\r\n    ],\r\n]);\r\n\r\n\/\/\u6708\u306e\u65e5\u672c\u8a9e\u5316\r\n$calendar-&gt;setMonths([\r\n    'january' =&gt; '1\u6708',\r\n    'february' =&gt; '2\u6708',\r\n    'march' =&gt; '3\u6708',\r\n    'april' =&gt; '4\u6708',\r\n    'may' =&gt; '5\u6708',\r\n    'june' =&gt; '6\u6708',\r\n    'july' =&gt; '7\u6708',\r\n    'august' =&gt; '8\u6708',\r\n    'september' =&gt; '9\u6708',\r\n    'october' =&gt; '10\u6708',\r\n    'november' =&gt; '11\u6708',\r\n    'december' =&gt; '12\u6708'\r\n]);\r\n\r\n\r\n\/\/\u6708\u66dc\u65e5\u59cb\u307e\u308a\u306b\u8a2d\u5b9a\r\n$calendar-&gt;useMondayStartingDate();\r\n$calendar-&gt;display(date('Y-m-d'));<\/pre>\n<p>\u300c$calendar-&gt;display(date('Y-m-d'));\u300d\u306e\u90e8\u5206\u3067\u8868\u793a\u3059\u308b\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u5e74\u6708\u3092\u6307\u5b9a\u3067\u304d\u308b\u30022024\u5e7412\u6708\u3092\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f\u300cdate('2024-12-01')\u300d\u306b\u306a\u308b\u3002<\/p>\n<p>\u5b9f\u904b\u7528\u306e\u969b\u306f\u300c\u7fcc\u6708\u300d\u300c\u524d\u6708\u300d\u307f\u305f\u3044\u306a\u30ea\u30f3\u30af\u3092\u8a2d\u7f6e\u3057\u300c?ym=2024-12-01\u300d\u7b49\u306eGET\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4ed8\u4e0e\u3059\u308b\u3088\u3046\u306a\u5f62\u306b\u306a\u308b\u3002<\/p>\n<h3>\u30c7\u30d5\u30a9\u30eb\u30c8\u306eCSS\u3092\u8aad\u307f\u8fbc\u307e\u305b\u306a\u3044<\/h3>\n<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u8868\u793a\u3055\u305b\u308b\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u306eCSS\u304c\u30a4\u30f3\u30e9\u30a4\u30f3\u3067\u6307\u5b9a\u3055\u308c\u308b\u3002Calendar.php\u306e\u4ee5\u4e0b\u90e8\u5206\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b\u3053\u3068\u3067CSS\u3092\u8aad\u307f\u8fbc\u307e\u306a\u304f\u306a\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public function display($date = false, $color = false)\r\n{\r\n    #\u4ee5\u4e0b\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n    #echo $this-&gt;stylesheet();\r\n    echo $this-&gt;draw($date, $color);\r\n}<\/pre>\n<h3>\u5e74\u6708\u306e\u8868\u793a\u3092\u300cM\u6708 YYYY\u300d\u304b\u3089\u300cYYYY\u5e74M\u6708\u306b\u5909\u66f4\u300d<\/h3>\n<p>Calendar.php\u3092\u4ee5\u4e0b\u306e\u901a\u308a\u5909\u66f4\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#\u5909\u66f4\u524d\r\n$calendar .= $this-&gt;months[strtolower($date-&gt;format('F'))] . ' ' . $date-&gt;format('Y');\r\n\r\n#\u5909\u66f4\u5f8c\r\n$calendar .= $date-&gt;format('Y') . '\u5e74' . $this-&gt;months[strtolower($date-&gt;format('F'))];<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u6240\u611f<\/h2>\n<p>composer\u7121\u3057\u3067\u3082\u5c0e\u5165\u53ef&amp;\u30d5\u30a1\u30a4\u30eb1\u679a\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u306e\u3067\u6c17\u8efd\u306b\u4f7f\u3044\u3084\u3059\u3044\u3002PHP\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u63cf\u5199\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u305f\u307e\u306b\u3057\u304b\u306a\u3044\u3051\u3069\u3001\u4eca\u5f8c\u3042\u308c\u3070\u4f7f\u3063\u3066\u3044\u304d\u305f\u3044\u3002<\/p>\n<p>\u5c1a\u3001\u66dc\u65e5\u3084\u5e74\u6708\u90e8\u5206\u3092\u82f1\u8a9e\u8868\u8a18\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u3042\u307e\u308a\u306a\u3055\u305d\u3046\u306a\u306e\u3067\u3001$calendar-&gt;setDays\u3067\u6307\u5b9a\u3059\u308b\u3088\u308a\u3082\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u76f4\u63a5\u5909\u66f4\u3057\u305f\u65b9\u304c\u5f8c\u3067\u4f7f\u3044\u307e\u308f\u3057\u3084\u3059\u3044\u4e0a\u3001\u30ab\u30ec\u30f3\u30c0\u30fc\u63cf\u5199\u5074\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u8a18\u8ff0\u91cf\u3082\u6e1b\u308a\u305d\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u3067\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u63cf\u5199\u3057\u305f\u3044\u3068\u3044\u3046\u3053\u3068\u304c\u305f\u307e\u306b\u3042\u308b\u3002\u4eca\u307e\u3067\u30d0\u30cb\u30e9PHP\u3067\u66f8\u3044\u3066 ... <\/p>\n","protected":false},"author":1,"featured_media":1085,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[100],"class_list":["post-5521","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-library"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/5521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/comments?post=5521"}],"version-history":[{"count":4,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/5521\/revisions"}],"predecessor-version":[{"id":5525,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/5521\/revisions\/5525"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/1085"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=5521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=5521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=5521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}