{"id":1038,"date":"2012-01-30T00:31:56","date_gmt":"2012-01-29T15:31:56","guid":{"rendered":"http:\/\/www.myu-zin.com\/webridge\/?p=1038"},"modified":"2018-07-14T11:37:02","modified_gmt":"2018-07-14T02:37:02","slug":"%e3%82%b9%e3%83%9e%e3%83%9b%e3%81%8b%e3%82%89%e3%81%ae%e3%82%a2%e3%82%af%e3%82%bb%e3%82%b9%e3%82%92%e5%88%a4%e5%88%a5%e3%81%97%e3%81%a6%e5%8b%95%e4%bd%9c%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88","status":"publish","type":"post","link":"https:\/\/www.myu-zin.com\/webridge\/archives\/1038.html","title":{"rendered":"\u30b9\u30de\u30db\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u5224\u5225\u3057\u3066\u52d5\u4f5c\u3092\u5207\u308a\u66ff\u3048\u308bCSS\u3001PHP\u3001Javascript\u3001.htaccess"},"content":{"rendered":"<h3>CSS\u3067\u5207\u308a\u66ff\u3048\u308b<\/h3>\n<p>\u30c7\u30d0\u30a4\u30b9\u306e\u5e45\u306b\u3088\u3063\u3066\u52d5\u4f5c\u3092\u304d\u308a\u304b\u3048\u307e\u3059\u3002\u4e0b\u8a18\u3060\u3068\u6700\u5927\u5e45480px\u306e\u5834\u5408\u306f\u300csp.css\u300d\u3092\u53c2\u7167\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\n&lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; media=&quot;only screen and (max-device-width:480px)&quot; href=&quot;.\/layout\/sp.css&quot;\/&gt;\r\n&lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; media=&quot;screen and (min-device-width:481px)&quot; href=&quot;.\/layout\/pc.css&quot; \/&gt;\r\n<\/pre>\n<h3>PHP\u3067\u5207\u308a\u66ff\u3048\u308b<\/h3>\n<p>\u30e6\u30fc\u30b6\u30fc\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u5224\u5225\u3057\u3066PHP\u3067\u6761\u4ef6\u5206\u5c90\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\n&lt;?php\r\n  $ua=$_SERVER&#x5B;'HTTP_USER_AGENT'];\r\n  $browser = ((strpos($ua,'iPhone')!==false)||(strpos($ua,'iPod')!==false)||(strpos($ua,'Android')!==false));\r\n    if ($browser == true){\r\n    $browser = 'sp';\r\n  }\r\n?&gt;\r\n&lt;?php if($browser == 'sp'){ ?&gt;\r\n    &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;css\/sp.css&quot;\/&gt;\r\n&lt;?php }else{ ?&gt;\r\n    &lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;css\/pc.css&quot; \/&gt;\r\n&lt;?php } ?&gt;\r\n\r\n\r\n<\/pre>\n<h3>JavaScript\u3067\u5207\u308a\u66ff\u3048\u308b<\/h3>\n<p>\u30e6\u30fc\u30b6\u30fc\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u5224\u5225\u3057\u3066JavaScript\u3067\u6761\u4ef6\u5206\u5c90\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\nif ((navigator.userAgent.indexOf('iPhone') &gt; 0 &amp;&amp; navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') &gt; 0 || navigator.userAgent.indexOf('Android') &gt; 0) {\r\n\tdocument.write('&lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;.\/layout\/sp.css&quot;&gt;');\r\n}else {\r\n        document.write('&lt;link rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; href=&quot;.\/layout\/pc.css&quot;&gt;');\r\n    }\r\n<\/pre>\n<h3>.htaccess\u3067\u5207\u308a\u66ff\u3048\u308b(\u5225URL\u3078)<\/h3>\n<p>\u30e6\u30fc\u30b6\u30fc\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u5224\u5225\u3057\u3066.htaccess\u3067\u6761\u4ef6\u5206\u5c90\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9; notranslate\" title=\"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\">\r\nRewriteEngine On\r\n\r\n# Set enviroment value by user-agent\r\nSetEnvIf User-Agent &quot;iPhone&quot; UA=sp\r\nSetEnvIf User-Agent &quot;iPod&quot; UA=sp\r\nSetEnvIf User-Agent &quot;Android&quot; UA=sp\r\n\r\n# Redirect if smart phone\r\nRewriteCond %{REQUEST_URI} !^\/sp.*\r\nRewriteCond %{ENV:UA} ^sp$\r\nRewriteRule ^(.*)$ \/sp\/ &#x5B;R,L]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CSS\u3067\u5207\u308a\u66ff\u3048\u308b \u30c7\u30d0\u30a4\u30b9\u306e\u5e45\u306b\u3088\u3063\u3066\u52d5\u4f5c\u3092\u304d\u308a\u304b&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[47,10,13,89,65,73,21],"tags":[108,69,102,106,107],"class_list":["post-1038","post","type-post","status-publish","format-standard","hentry","category-css","category-html","category-iphone","category-javascript","category-php","category-73","category-21","tag-apache","tag-css-2","tag-htaccess","tag-javascript","tag-php"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts\/1038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/comments?post=1038"}],"version-history":[{"count":13,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts\/1038\/revisions"}],"predecessor-version":[{"id":1281,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/posts\/1038\/revisions\/1281"}],"wp:attachment":[{"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/media?parent=1038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/categories?post=1038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myu-zin.com\/webridge\/wp-json\/wp\/v2\/tags?post=1038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}