{"id":90,"date":"2016-10-22T22:49:52","date_gmt":"2016-10-22T13:49:52","guid":{"rendered":"http:\/\/www.dogrow.net\/php\/?p=90"},"modified":"2025-04-26T19:20:28","modified_gmt":"2025-04-26T10:20:28","slug":"blog7","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/php\/blog7\/","title":{"rendered":"(7) SQLite\u3067\u30a2\u30af\u30bb\u30b9\u30ab\u30a6\u30f3\u30bf\u4f5c\u6210 #2 (\u753b\u50cf\u5316)"},"content":{"rendered":"<h1 class=my_h>\u3084\u3063\u3066\u307f\u305f\u3044\u3053\u3068<\/h1>\n<p><a href=\"\/\/www.dogrow.net\/php\/archives\/81\">\u300c(6) SQLite\u3067\u30a2\u30af\u30bb\u30b9\u30ab\u30a6\u30f3\u30bf\u4f5c\u6210 #1\u300d<\/a> \u3067\u306f\u30ab\u30a6\u30f3\u30c8\u5024\u3092\u30c6\u30ad\u30b9\u30c8\u8868\u793a\u3057\u3066\u3044\u305f\u3002<br \/>\n\u4eca\u56de\u306f\u3053\u308c\u3092\u753b\u50cf\u8868\u793a\u306b\u5909\u66f4\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>\u753b\u50cf\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\uff10\uff5e\uff19\u306e\u753b\u50cf\u3092\u81ea\u4f5c\u3057\u305f\u3002<br \/>\ncounter_img.php\u3067\u306f\u3001\u5f15\u6570\u3067\u6e21\u3055\u308c\u305f\u30ab\u30a6\u30f3\u30c8\u5024\u306b\u5f93\u3063\u3066\uff10\uff5e\uff19\u306e\u753b\u50cf\u3092\u9023\u7d50\u3057\u305f1\u679a\u306eGIF\u753b\u50cf\u3092\u4f5c\u6210\u3057\u3001HTTP\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5bfe\u3059\u308b\u5fdc\u7b54\u3068\u3057\u3066\u51fa\u529b\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3002<br \/>\n<img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/0.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/1.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/2.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/3.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/4.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/5.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/6.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/7.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/8.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/1\/9.gif\"><br \/>\n<img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/0.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/1.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/2.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/3.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/4.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/5.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/6.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/7.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/8.gif\"><img decoding=\"async\" class=timg src=\"\/\/www.dogrow.net\/php\/sample\/00007\/2\/9.gif\"><\/p>\n<p><a href=\"\/\/www.dogrow.net\/php\/sample\/00007\/\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.dogrow.net\/php\/wp-content\/uploads\/2016\/10\/00007_1.png\" alt=\"00007_1\" width=\"320\" height=\"212\" class=\"alignnone size-full wp-image-91\" style=\"margin-top:1rem;\" srcset=\"https:\/\/www.dogrow.net\/php\/wp-content\/uploads\/2016\/10\/00007_1.png 320w, https:\/\/www.dogrow.net\/php\/wp-content\/uploads\/2016\/10\/00007_1-300x199.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>\u5b9f\u884c\u30b5\u30f3\u30d7\u30eb\u306f\u3053\u3061\u3089\u3067\u3059\u3002<br \/>\n<a href=\"\/\/www.dogrow.net\/php\/sample\/00007\/\" target=\"_blank\">\/\/www.dogrow.net\/php\/sample\/00007\/<\/a><\/p>\n<h1 class=my_h>\u30d7\u30ed\u30b0\u30e9\u30e0\u4f5c\u6210<\/h1>\n<pre class=\"brush: php; title: index.php; notranslate\" title=\"index.php\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;utf-8&quot; \/&gt;\r\n&lt;title&gt;SQLite\u30b5\u30f3\u30d7\u30eb&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;?php\r\n  \/\/ \u30ab\u30a6\u30f3\u30c8\u5024\u3092\u8868\u793a\uff08\u753b\u50cf\u30bf\u30a4\u30d71\u4e14\u3064\u30016\u6841\u8868\u793a\u3092\u6307\u5b9a\uff09\r\n  echo &quot;&lt;img src=&quot;counter_img.php?typ=1&amp;dig=6&quot;&gt;&quot;;\r\n?&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<pre class=\"brush: php; title: counter_img.php; notranslate\" title=\"counter_img.php\">\r\n&lt;?php\r\n  \/\/ \u5f15\u6570\u3092\u53d6\u5f97\r\n  $typ = $_GET&#x5B;'typ'];    \/\/ \u753b\u50cf\u30bf\u30a4\u30d7\r\n  $dig = $_GET&#x5B;'dig'];    \/\/ \u6841\u6570\r\n  if($dig &gt; 10){\r\n    $dig = 10;\r\n  }\r\n\r\n  \/\/ \u30ab\u30a6\u30f3\u30c8\u5024\u3092\u53d6\u5f97\r\n  require_once(&quot;CCounter.php&quot;);\r\n  $cCnt = new CCounter();\r\n  $cCnt-&gt;connect_db();              \/\/ DB\u63a5\u7d9a\r\n  $cnt = $cCnt-&gt;count_up();         \/\/ \u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\uff06\u5024\u53d6\u5f97\r\n  $cCnt-&gt;disconnect_db();           \/\/ DB\u5207\u65ad\r\n\r\n  \/\/ 1\u6841\u305a\u3064\u753b\u50cf\u3092\u4f5c\u6210\r\n  $digImg = array();\r\n  $w = 0; $h = 0;\r\n  for($i=0 ; $i&lt;$dig ; $i++){\r\n    $v = $cnt % 10;\r\n    $imgPath = $typ.&quot;\/&quot;.$v.&quot;.gif&quot;;\r\n    $digImg&#x5B;] = imagecreatefromgif($imgPath);\r\n    if($w == 0){\r\n      list($w, $h) = getimagesize($imgPath);\r\n    }\r\n    $cnt = intval($cnt \/ 10);\r\n  }\r\n  $digImg = array_reverse($digImg);\r\n\r\n  \/\/ \u7d50\u5408\u753b\u50cf\u3092\u4f5c\u6210\r\n  $newImg = imagecreate($w * $dig, $h);\r\n  $x = 0;\r\n  foreach($digImg as $oneImg){\r\n    imagecopy($newImg, $oneImg, $x, 0, 0, 0, $w, $h);\r\n    imagedestroy($oneImg);\r\n    $x += $w;\r\n  }\r\n\r\n  \/\/ GIF\u753b\u50cf\u51fa\u529b\r\n  header('Content-Type: image\/gif');\r\n  imagegif($newImg);\r\n  imagedestroy($newImg);\r\n?&gt;\r\n<\/pre>\n<p>\u3000<br \/>\n\u5b9f\u884c\u30b5\u30f3\u30d7\u30eb\u306f\u3053\u3061\u3089\u3067\u3059\u3002<br \/>\n<a href=\"\/\/www.dogrow.net\/php\/sample\/00007\/\" target=\"_blank\">\/\/www.dogrow.net\/php\/sample\/00007\/<\/a><\/p>\n<hr class=my_hr_bottom>\n","protected":false},"excerpt":{"rendered":"<p>\u3084\u3063\u3066\u307f\u305f\u3044\u3053\u3068 \u300c(6) SQLite\u3067\u30a2\u30af\u30bb\u30b9\u30ab\u30a6\u30f3\u30bf\u4f5c\u6210 #1\u300d \u3067\u306f\u30ab\u30a6\u30f3\u30c8\u5024\u3092\u30c6\u30ad\u30b9\u30c8\u8868\u793a\u3057\u3066\u3044\u305f\u3002 \u4eca\u56de\u306f\u3053\u308c\u3092\u753b\u50cf\u8868\u793a\u306b\u5909\u66f4\u3057\u3066\u307f\u308b\u3002 \u753b\u50cf\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\uff10\uff5e\uff19\u306e\u753b\u50cf\u3092\u81ea\u4f5c\u3057\u305f\u3002 counter_img.p\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/php\/blog7\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,2],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-sqlite","category-5","category-2"],"views":2046,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/posts\/90","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":47,"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"predecessor-version":[{"id":2124,"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/posts\/90\/revisions\/2124"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/php\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}