{"id":778,"date":"2011-02-25T23:53:33","date_gmt":"2011-02-25T14:53:33","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=778"},"modified":"2013-03-30T17:18:22","modified_gmt":"2013-03-30T08:18:22","slug":"php%e3%81%a7%e7%b0%a1%e6%98%93%e3%82%a2%e3%83%b3%e3%82%b1%e3%83%bc%e3%83%88","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=778","title":{"rendered":"PHP\u3067\u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8"},"content":{"rendered":"<p>PHP\u3067\u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8\u5b9f\u88c5\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">YES or NO\u65b9\u5f0f\u3067\u30c8\u30fc\u30bf\u30eb\u4eba\u6570\u3068YES\u306e\u4eba\u6570\u3092\u8868\u793a\u3055\u305b\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em; text-align: center;\"><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/yesno.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-779 align center\" title=\"yes no\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/yesno.png\" alt=\"\" width=\"389\" height=\"211\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/yesno.png 389w, https:\/\/www.webcyou.com\/wp-content\/uploads\/yesno-300x162.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/a><\/p>\n<p style=\"margin-top: 1em;\">\u3053\u3093\u306a\u611f\u3058\u306b\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u307e\u305a\u306fHTML\u3068CSS\u3067\u666e\u901a\u306b\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u3002<\/p>\n<p style=\"margin-top: 1em;\"><strong>HTML<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;div id=&quot;yesNoArea&quot;&gt;\r\n  &lt;p class=&quot;r1&quot;&gt;&lt;img src=&quot;title.gif&quot; width=&quot;272&quot; height=&quot;36&quot; \/&gt;&lt;\/p&gt;\r\n  &lt;p class=&quot;r2&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;yes_btn.gif&quot; alt=&quot;\u306f\u3044&quot; width=&quot;164&quot; height=&quot;58&quot; border=&quot;0&quot; \/&gt;&lt;\/a&gt;&amp;nbsp;&lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;no_btn.gif&quot; alt=&quot;\u3044\u3044\u3048&quot; width=&quot;164&quot; height=&quot;58&quot; border=&quot;0&quot; \/&gt;&lt;\/a&gt;&lt;\/p&gt;\r\n  &lt;p class=&quot;r3&quot;&gt;&lt;span class=&quot;total&quot;&gt;500&lt;\/span&gt;\u4eba\u4e2d&amp;nbsp;&amp;nbsp;&lt;span class=&quot;manTotal&quot;&gt;369&lt;\/span&gt;\u4eba\u304c&lt;span class=&quot;man&quot;&gt;\u7537\u6027&lt;\/span&gt;\u3067\u3059\u3002&lt;\/p&gt;\r\n&lt;\/div&gt;<\/pre>\n<\/p>\n<p style=\"margin-top: 1em;\"><strong>CSS<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#yesNoArea {\r\n  width:374px;\r\n  margin:0 auto;\r\n}\r\n#yesNoArea .r1,\r\n#yesNoArea .r2,\r\n#yesNoArea .r3 { text-align:center; }\r\n#yesNoArea .r3 { font-size:14px; }\r\n#yesNoArea .r3 .total {\r\n  font-size:32px;\r\n  font-weight:bold;\r\n  color:#F26611;\r\n}\r\n#yesNoArea .r3 .manTotal {\r\n  font-size:32px;\r\n  font-weight:bold;\r\n  color:#39F;\r\n}\r\n#yesNoArea .r3 .man {\r\n  font-size:18px;\r\n  font-weight:bold;\r\n}\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u4e0a\u306e\u30c6\u30ad\u30b9\u30c8\u3068\u30dc\u30bf\u30f3\u306f\u5358\u7d14\u306b\u753b\u50cf\u3092\u7f6e\u3044\u3066\u307e\u3059\u3002\u3042\u3048\u3066a\u8981\u7d20\u3067\u5b9f\u88c5\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u5f53\u305f\u308a\u524d\u3067\u3059\u304c\u307e\u3060\u8a2d\u5b9a\u3092\u884c\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u4f55\u3082\u8d77\u3053\u308a\u307e\u305b\u3093\u3002<\/p>\n<p style=\"margin-top: 1em;\"><a href=\"http:\/\/webcyou.com\/demo\/php\/yesno\/yes-no001.html\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8<\/a><\/p>\n<p style=\"margin-top: 1em;\">\u3067\u306f\u5024\u3092\u53d7\u3051\u53d6\u308c\u308b\u3088\u3046\u306bform\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><strong> HTML<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;form action=&quot;index.php&quot; method=&quot;POST&quot; name=&quot;yes&quot;&gt;\r\n  &lt;input type=&quot;hidden&quot;  name=&quot;yes&quot; value=&quot;yes&quot;&gt;\r\n&lt;\/form&gt;\r\n&lt;form action=&quot;index.php&quot; method=&quot;POST&quot; name=&quot;no&quot;&gt;\r\n  &lt;input type=&quot;hidden&quot; name=&quot;no&quot; value=&quot;no&quot;\/&gt;\r\n&lt;\/form&gt;<\/pre>\n<p style=\"margin-top: 1em;\">\u3068\u540c\u6642\u306ba\u30bf\u30b0\u306b\u3082submit\u306e\u8a2d\u5b9a\u3092<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;document.yes.submit()&quot;&gt;\r\n&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;document.no.submit()&quot;&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\"><strong>\u5168\u4f53HTML<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;body&gt;\r\n  &lt;form action=&quot;index.php&quot; method=&quot;POST&quot; name=&quot;yes&quot;&gt;\r\n    &lt;input type=&quot;hidden&quot;  name=&quot;yes&quot; value=&quot;yes&quot;&gt;\r\n  &lt;\/form&gt;\r\n  &lt;form action=&quot;index.php&quot; method=&quot;POST&quot; name=&quot;no&quot;&gt;\r\n    &lt;input type=&quot;hidden&quot; name=&quot;no&quot; value=&quot;no&quot;\/&gt;\r\n  &lt;\/form&gt;\r\n  &lt;div id=&quot;yesNoArea&quot;&gt;\r\n    &lt;p class=&quot;r1&quot;&gt;&lt;img src=&quot;title.gif&quot; width=&quot;272&quot; height=&quot;36&quot; \/&gt;&lt;\/p&gt;\r\n    &lt;p class=&quot;r2&quot;&gt;&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;document.yes.submit()&quot;&gt;&lt;img src=&quot;yes_btn.gif&quot; alt=&quot;\u306f\u3044&quot; width=&quot;164&quot; height=&quot;58&quot; border=&quot;0&quot; \/&gt;&lt;\/a&gt;&amp;nbsp;&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;document.no.submit()&quot;&gt;&lt;img src=&quot;no_btn.gif&quot; alt=&quot;\u3044\u3044\u3048&quot; width=&quot;164&quot; height=&quot;58&quot; border=&quot;0&quot; \/&gt;&lt;\/a&gt;&lt;\/p&gt;\r\n&lt;p class=&quot;r3&quot;&gt;&lt;span class=&quot;total&quot;&gt;500&lt;\/span&gt;\u4eba\u4e2d&amp;nbsp;&amp;nbsp;&lt;span class=&quot;manTotal&quot;&gt;369&lt;\/span&gt;\u4eba\u304c&lt;span class=&quot;man&quot;&gt;\u7537\u6027&lt;\/span&gt;\u3067\u3059\u3002&lt;\/p&gt;\r\n&lt;\/div&gt;\r\n&lt;\/body&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\"><a href=\"http:\/\/webcyou.com\/demo\/php\/yesno\/yes-no002.html\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8<\/a><\/p>\n<h5>\u30ab\u30a6\u30f3\u30c8\u7528\u30d5\u30a1\u30a4\u30eb\u7528\u610f<\/h5>\n<p style=\"margin-top: 1em;\">\u3053\u3053\u307e\u3067\u51fa\u6765\u305f\u3089\u3001\u30c8\u30fc\u30bf\u30eb\u30ab\u30a6\u30f3\u30c8\u7528\u306b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u300ctotal.txt\u300d<\/p>\n<p style=\"margin-top: 1em;\">YES\u306e\u30ab\u30a6\u30f3\u30c8\u7528\u306b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u300cyes.txt\u300d\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\"><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/textimg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-780\" title=\"textimg\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/textimg.png\" alt=\"\" width=\"235\" height=\"137\" \/><\/a><\/p>\n<p style=\"margin-top: 1em;\">\u6570\u5b57\u306e\u300c0\u300d\u3092\u8a18\u5165\u3057\u3001\u540c\u968e\u5c64\u306b\u914d\u7f6e\u3002\uff08\u6570\u5b57\u3092\u5165\u308c\u306a\u3044\u3068\u8d77\u52d5\u3057\u307e\u305b\u3093\u3002\uff09<\/p>\n<p style=\"margin-top: 1em;\">\u914d\u7f6e\u3057\u305f\u3089\u3001\u5148\u307b\u3069\u306eHTML\u30d5\u30a1\u30a4\u30eb\u3092\u62e1\u5f35\u5b50\u300c.php\u300d\u306ePHP\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3057\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u3067\u306f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u6271\u3046PHP\u69cb\u6587\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p><strong>PHP<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php\r\n  \/\/\u5168\u4f53\u4eba\u6570\r\n  $fp = @fopen(&quot;total.txt&quot;,&quot;r+&quot;) or die(&quot;\uff8c\uff67\uff72\uff99\u304c\u958b\u3051\u307e\u305b\u3093&quot;);\/\/\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30aa\u30fc\u30d7\u30f3\r\n  flock($fp, LOCK_EX);\/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\r\n  $count = fgets($fp, 64); \/\/64\u30d0\u30a4\u30c8orEOF\u307e\u3067\u53d6\u5f97\u3001\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\r\n  rewind($fp); \/\/\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u3001\u30ed\u30c3\u30af\u3057\u3066\u66f8\u304d\u8fbc\u307f\r\n?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u30b3\u30e1\u30f3\u30c8\u306e\u901a\u308a\u3001\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u30aa\u30fc\u30d7\u30f3\u3057\u3001<\/p>\n<p style=\"margin-top: 1em;\">\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u6392\u4ed6\u5236\u5fa1\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/www.webcyou.com\/?p=774\">\u3053\u3061\u3089<\/a>\u3092\u53c2\u7167\u3002<\/p>\n<h3 style=\"margin-top: 1em;\"><a href=\"https:\/\/www.webcyou.com\/?p=774\">PHP \u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u8fbc\u307f\u306e\u6392\u4ed6\u5236\u5fa1<\/a><\/h3>\n<p style=\"margin-top: 1em;\">\u6700\u5f8c\u306b\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u5408\u308f\u305b\u308b\u305f\u3081rewind()\u95a2\u6570\u3092\u8a18\u8ff0\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u540c\u3058\u3088\u3046\u306b\u3001<strong>YES\u306e\u30ab\u30a6\u30f3\u30c8\u7528<\/strong>\u306bPHP\u6587\u3092\u8a18\u8ff0\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php\r\n  \/\/\u306f\u3044\u8868\u793a\u51e6\u7406\r\n  $fp01 = @fopen(&quot;yes.txt&quot;,&quot;r+&quot;) or die(&quot;\uff8c\uff67\uff72\uff99\u304c\u958b\u3051\u307e\u305b\u3093&quot;);\/\/\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30aa\u30fc\u30d7\u30f3\r\n  flock($fp01, LOCK_EX); \/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\r\n  $yes = fgets($fp01, 64);\/\/64\u30d0\u30a4\u30c8orEOF\u307e\u3067\u53d6\u5f97\u3001\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\r\n  rewind($fp01);\r\n?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\"><strong>\u30d5\u30a9\u30fc\u30e0\u306e\u5024\u3092\u53d7\u3051\u53d6\u308b<\/strong>PHP\u6587\u3092<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php\r\n  \/\/\u5024\u4ee3\u5165\u51e6\u7406\r\n  $value01 = $_POST&#x5B;yes];\r\n  $value02 = $_POST&#x5B;no];\r\n?&gt;<\/pre>\n<p style=\"margin-top: 1em;\"><strong>\u30ab\u30a6\u30f3\u30c8\u51e6\u7406<\/strong>\u306ePHP\u6587\u3092<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php\r\n  \/\/\u30c8\u30fc\u30bf\u30eb\u30ab\u30a6\u30f3\u30c8\u51e6\u7406\r\n  if ($value01 == yes || $value02 == no) {\r\n    $count++;\r\n    rewind($fp);\r\n  }\r\n  \/\/\u5206\u5c90\u51e6\u7406 \u306f\u3044\r\n  if($value01 == yes){\r\n    $yes++;\r\n    rewind($fp01);\/\/\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u3001\u30ed\u30c3\u30af\u3057\u3066\u66f8\u304d\u8fbc\u307f\r\n  };\r\n?&gt;\r\n<\/pre>\n<p>YES\u304bNO\u306e\u5834\u5408\u306f\u30c8\u30fc\u30bf\u30eb\u306e\u30ab\u30a6\u30f3\u30c8\u6570\u3092\u5897\u52a0\u3001<br \/>\nYES\u306e\u5834\u5408\u306e\u307fYES\u306e\u30ab\u30a6\u30f3\u30c8\u6570\u3092\u5897\u52a0\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u4ee3\u5165\u3057\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\u69cb\u6587<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php\r\n  fputs($fp, $count); \/\/\u958b\u3051\u3066\u4ee3\u5165\r\n  fclose($fp); \/\/\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\r\n  fputs($fp01, $yes);\r\n  fclose($fp01);\r\n?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u5b8c\u4e86!!!<\/p>\n<h4> \u7c21\u6613\u30ab\u30a6\u30f3\u30c8\u5f0f\u30a2\u30f3\u30b1\u30fc\u30c8 PHP\u30d5\u30a1\u30a4\u30eb<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php \/* \u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8 by d.t https:\/\/www.webcyou.com  *\/\r\n  \/\/\u5168\u4f53\u4eba\u6570\r\n  $fp = @fopen(&quot;total.txt&quot;,&quot;r+&quot;) or die(&quot;\uff8c\uff67\uff72\uff99\u304c\u958b\u3051\u307e\u305b\u3093&quot;); \/\/\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30aa\u30fc\u30d7\u30f3\r\n  flock($fp, LOCK_EX); \/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\r\n  $count = fgets($fp, 64); \/\/64\u30d0\u30a4\u30c8orEOF\u307e\u3067\u53d6\u5f97\u3001\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\r\n  rewind($fp); \/\/\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u3001\u30ed\u30c3\u30af\u3057\u3066\u66f8\u304d\u8fbc\u307f\r\n  \r\n  \/\/\u306f\u3044\u8868\u793a\u51e6\u7406\r\n  $fp01 = @fopen(&quot;yes.txt&quot;,&quot;r+&quot;) or die(&quot;\uff8c\uff67\uff72\uff99\u304c\u958b\u3051\u307e\u305b\u3093&quot;); \/\/\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30aa\u30fc\u30d7\u30f3\r\n  flock($fp01, LOCK_EX); \/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\r\n  $yes = fgets($fp01, 64); \/\/64\u30d0\u30a4\u30c8orEOF\u307e\u3067\u53d6\u5f97\u3001\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\r\n  rewind($fp01);\r\n  \r\n  \/\/\u5024\u4ee3\u5165\u51e6\u7406\r\n  $value01 = $_POST&#x5B;yes];\r\n  $value02 = $_POST&#x5B;no];\r\n\r\n  \/\/\u30c8\u30fc\u30bf\u30eb\u30ab\u30a6\u30f3\u30c8\u51e6\u7406\r\n  if ($value01 == yes || $value02 == no) {\r\n    $count++;\r\n    rewind($fp);\r\n  }\r\n\r\n  \/\/\u5206\u5c90\u51e6\u7406 \u306f\u3044\r\n  if($value01 == yes){\r\n    $yes++;\r\n    rewind($fp01);\/\/\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u3001\u30ed\u30c3\u30af\u3057\u3066\u66f8\u304d\u8fbc\u307f\r\n  };\r\n  fputs($fp, $count); \/\/\u958b\u3051\u3066\u4ee3\u5165\r\n  fclose($fp); \/\/\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\r\n  fputs($fp01, $yes);\r\n  fclose($fp01);\r\n?&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\">\u306b\u4f34\u3044\u3001form\u306eaction\u306e\u5024\u3092\u540c\u30d5\u30a1\u30a4\u30eb\u5148\u306b\u5909\u66f4<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"> action=\".\/yes-no003.php\" <\/pre>\n<p style=\"margin-top: 1em;\">\u30c8\u30fc\u30bf\u30eb\u4eba\u6570\u8868\u793a\u3059\u308b\u5834\u6240\u306becho\u6587\u3092<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php echo $count;?&gt;<\/pre>\n<p style=\"margin-top: 1em;\">YES\u306e\u4eba\u6570\u8868\u793a\u90e8\u5206\u306b\u540c\u3058\u304fecho\u6587\u3092<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">&lt;?php echo $yes;?&gt;<\/pre>\n<p style=\"margin-top: 1em;\">\u3067\u3001\u5b8c\u4e86\u3067\u3059\uff01<\/p>\n<h4><strong>\u7c21\u6613\u30ab\u30a6\u30f3\u30c8\u5f0f\u30a2\u30f3\u30b1\u30fc\u30c8 \u30d5\u30a1\u30a4\u30eb\u5168\u6587<\/strong><\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;?php \/* \u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8 by d.t https:\/\/www.webcyou.com  *\/\r\n  \/\/\u5168\u4f53\u4eba\u6570\r\n  $fp = @fopen(&quot;total.txt&quot;,&quot;r+&quot;) or die(&quot;\uff8c\uff67\uff72\uff99\u304c\u958b\u3051\u307e\u305b\u3093&quot;); \/\/\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30aa\u30fc\u30d7\u30f3\r\n  flock($fp, LOCK_EX); \/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\r\n  $count = fgets($fp, 64); \/\/64\u30d0\u30a4\u30c8orEOF\u307e\u3067\u53d6\u5f97\u3001\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\r\n  rewind($fp); \/\/\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u3001\u30ed\u30c3\u30af\u3057\u3066\u66f8\u304d\u8fbc\u307f\r\n  \r\n  \/\/\u306f\u3044\u8868\u793a\u51e6\u7406\r\n  $fp01 = @fopen(&quot;yes.txt&quot;,&quot;r+&quot;) or die(&quot;\uff8c\uff67\uff72\uff99\u304c\u958b\u3051\u307e\u305b\u3093&quot;); \/\/\u8aad\u307f\u66f8\u304d\u30e2\u30fc\u30c9\u3067\u30aa\u30fc\u30d7\u30f3\r\n  flock($fp01, LOCK_EX); \/\/\u30d5\u30a1\u30a4\u30eb\u306e\u6392\u4ed6\u5236\u5fa1\r\n  $yes = fgets($fp01, 64); \/\/64\u30d0\u30a4\u30c8orEOF\u307e\u3067\u53d6\u5f97\u3001\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\r\n  rewind($fp01);\r\n  \r\n  \/\/\u5024\u4ee3\u5165\u51e6\u7406\r\n  $value01 = $_POST&#x5B;yes];\r\n  $value02 = $_POST&#x5B;no];\r\n\r\n  \/\/\u30c8\u30fc\u30bf\u30eb\u30ab\u30a6\u30f3\u30c8\u51e6\u7406\r\n  if ($value01 == yes || $value02 == no) {\r\n    $count++;\r\n    rewind($fp);\r\n  }\r\n\r\n  \/\/\u5206\u5c90\u51e6\u7406 \u306f\u3044\r\n  if($value01 == yes){\r\n    $yes++;\r\n    rewind($fp01);\/\/\u30dd\u30a4\u30f3\u30bf\u3092\u5148\u982d\u306b\u3001\u30ed\u30c3\u30af\u3057\u3066\u66f8\u304d\u8fbc\u307f\r\n  };\r\n\r\n  fputs($fp, $count); \/\/\u958b\u3051\u3066\u4ee3\u5165\r\n  fclose($fp); \/\/\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\r\n  fputs($fp01, $yes);\r\n  fclose($fp01);\r\n?&gt;\r\n&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;\r\n&lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=UTF-8&quot; \/&gt;\r\n&lt;title&gt;\u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8&lt;\/title&gt;\r\n&lt;style type=&quot;text\/css&quot;&gt;\r\n#yesNoArea {\r\n  width:374px;\r\n  margin:0 auto;\r\n}\r\n#yesNoArea .r1,\r\n#yesNoArea .r2,\r\n#yesNoArea .r3 { text-align:center; }\r\n#yesNoArea .r3 { font-size:14px; }\r\n#yesNoArea .r3 .total{\r\n  font-size:32px;\r\n  font-weight:bold;\r\n  color:#F26611;\r\n}\r\n#yesNoArea .r3 .manTotal {\r\n  font-size:32px;\r\n  font-weight:bold;\r\n  color:#39F;\r\n}\r\n#yesNoArea .r3 .man {\r\n  font-size:18px;\r\n  font-weight:bold;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n  &lt;form action=&quot;.\/yes-no003.php&quot; method=&quot;POST&quot; name=&quot;yes&quot;&gt;\r\n    &lt;input type=&quot;hidden&quot;  name=&quot;yes&quot; value=&quot;yes&quot;&gt;\r\n  &lt;\/form&gt;\r\n  &lt;form action=&quot;.\/yes-no003.php&quot; method=&quot;POST&quot; name=&quot;no&quot;&gt;\r\n    &lt;input type=&quot;hidden&quot; name=&quot;no&quot; value=&quot;no&quot;\/&gt;\r\n  &lt;\/form&gt;\r\n  &lt;div id=&quot;yesNoArea&quot;&gt;\r\n    &lt;p class=&quot;r1&quot;&gt;&lt;img src=&quot;title.gif&quot; width=&quot;272&quot; height=&quot;36&quot; \/&gt;&lt;\/p&gt;\r\n    &lt;p class=&quot;r2&quot;&gt;&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;document.yes.submit()&quot;&gt;&lt;img src=&quot;yes_btn.gif&quot; alt=&quot;\u306f\u3044&quot; width=&quot;164&quot; height=&quot;58&quot; border=&quot;0&quot; \/&gt;&lt;\/a&gt;&amp;nbsp;&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;document.no.submit()&quot;&gt;&lt;img src=&quot;no_btn.gif&quot; alt=&quot;\u3044\u3044\u3048&quot; width=&quot;164&quot; height=&quot;58&quot; border=&quot;0&quot; \/&gt;&lt;\/a&gt;&lt;\/p&gt;\r\n    &lt;p class=&quot;r3&quot;&gt;&lt;span class=&quot;total&quot;&gt;&lt;?php echo $count;?&gt;&lt;\/span&gt;\u4eba\u4e2d&amp;nbsp;&amp;nbsp;&lt;span class=&quot;manTotal&quot;&gt;&lt;?php echo $yes;?&gt;&lt;\/span&gt;\u4eba\u304c&lt;span class=&quot;man&quot;&gt;\u7537\u6027&lt;\/span&gt;\u3067\u3059\u3002&lt;\/p&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p style=\"margin-top: 1em;\"><a href=\"http:\/\/webcyou.com\/demo\/php\/yesno\/yes-no003.php\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u3053\u3061\u3089\u304b\u3089<\/a><\/p>\n<p style=\"margin-top: 1em; text-align: center;\"><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/yesno.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" title=\"yesno\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/yesno.png\" alt=\"\" width=\"389\" height=\"211\" \/><\/a><\/p>\n<p style=\"margin-top: 1em;\">\u4ee5\u4e0a\u3002<\/p>\n<p style=\"margin-top: 1em;\">\u00a0<\/p>\n<p style=\"margin-top: 1em;\">\u66f4\u306b\u30d1\u30fc\u30bb\u30f3\u30c8\u3067\u30d0\u30fc\u8868\u793a\u3092\u884c\u3046\u65b9\u6cd5\u306f<\/p>\n<h3><a href=\"https:\/\/www.webcyou.com\/?p=787\">PHP\u3067\u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8 \u30d1\u30fc\u30bb\u30f3\u30c6\u30fc\u30b8\u30d0\u30fc\u8ffd\u52a0\u7de8<\/a><\/h3>\n<p>\u3053\u3061\u3089\u304b\u3089\u3002<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/glaf.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-788  aligncenter\" title=\"glaf\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/glaf.png\" alt=\"\" width=\"454\" height=\"320\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/glaf.png 454w, https:\/\/www.webcyou.com\/wp-content\/uploads\/glaf-300x211.png 300w\" sizes=\"auto, (max-width: 454px) 100vw, 454px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u3067\u7c21\u6613\u30a2\u30f3\u30b1\u30fc\u30c8\u5b9f\u88c5\u65b9\u6cd5\u3067\u3059\u3002 YES or NO\u65b9\u5f0f\u3067\u30c8\u30fc\u30bf\u30eb\u4eba\u6570\u3068YES\u306e\u4eba\u6570\u3092\u8868\u793a\u3055\u305b\u307e\u3059\u3002 \u3053\u3093\u306a\u611f\u3058\u306b\u3002 \u307e\u305a\u306fHTML\u3068CSS\u3067\u666e\u901a\u306b\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u3002 HTML &lt;div id=&quot;yesN [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[107,180,173],"class_list":["post-778","post","type-post","status-publish","format-standard","hentry","category-php","tag-mamp","tag-mysql","tag-php"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=778"}],"version-history":[{"count":17,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/778\/revisions"}],"predecessor-version":[{"id":4490,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/778\/revisions\/4490"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}