{"id":1257,"date":"2019-07-02T14:44:59","date_gmt":"2019-07-02T05:44:59","guid":{"rendered":"http:\/\/int-info.com\/?page_id=1257"},"modified":"2020-05-08T14:23:20","modified_gmt":"2020-05-08T05:23:20","slug":"pylearnweb06","status":"publish","type":"page","link":"http:\/\/int-info.com\/index.php\/pylearnweb06\/","title":{"rendered":"PyLearnWEB06"},"content":{"rendered":"<h4 style=\"padding: 0.1em 0.3em; border-left: 10px solid #1E88E5; border-bottom: 3px solid #B0BEC5;\"> \u306f\u3058\u3081\u306b <\/h4>\n<p>\u3053\u3053\u3067\u306f\u3001\u753b\u50cf\u3084\u52d5\u753b\u306a\u3069\u3001\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u3092Python\u3068bottle\u3092\u7528\u3044\u3066HTML\u4e0a\u306b\u8868\u793a\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001File\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308bimg01.png\u3068\u3044\u3046\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\u3092\u8ff0\u3079\u307e\u3059\u3002<\/p>\n<p><b>\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c&#8221;\u300d\u306fHTML\u5074\u3001\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u300c&#8217;\u300d\u306fpython\u5074\u306e\u6587\u5b57\u5217\u8a8d\u8b58<\/b>\u3067\u3059\u3002\u6df7\u540c\u3057\u306a\u3044\u3088\u3046\u306b\u3001\u843d\u3061\u7740\u3044\u3066\u3084\u3063\u3066\u304f\u3060\u3055\u3044\u3002\u6163\u308c\u306a\u3044\u3046\u3061\u306f\u30ce\u30fc\u30c8\u306a\u3069\u306b\u66f8\u304d\u306a\u304c\u3089\u3084\u3089\u306a\u3044\u3068\u6df7\u4e71\u3059\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u306a\u304a\u3001\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f33\u3064\u300c&#8221;&#8217;\u300d\u306f\u3001\u8907\u6570\u884c\u306e\u6587\u5b57\u5217\u3092\u6271\u3046\u3001python\u5074\u306e\u8a18\u8ff0\u3067\u3059\u3002<\/p>\n<p><\/br><\/p>\n<h4 style=\"padding: 0.1em 0.3em; border-left: 10px solid #1E88E5; border-bottom: 3px solid #B0BEC5;\"> \u30b3\u30fc\u30c9 <\/h4>\n<pre class=\"lang:python decode:true \" title=\"test.py\" >\r\n# -*- coding: utf-8 -*-\r\nfrom bottle import route, run, get, post, request, static_file, debug\r\nimport os\r\n\r\n# *** \u9759\u7684\u30d5\u30a1\u30a4\u30eb\u3092\u6271\u3046\u305f\u3081\u306e\u8a2d\u5b9a ***\r\n@route('\/File\/&lt;filename:path&gt;') # &lt;- (A)\r\ndef static(filename):\r\n    rootpass = os.getcwd() + \"\/File\" # &lt;- (B)\r\n    return static_file(filename, root=rootpass)\r\n\r\n# \u30c8\u30c3\u30d7\u30da\u30fc\u30b8\r\n@route('\/')\r\ndef TopPage():\r\n    # (C)\r\n    t= '''\r\n       &lt;head&gt;\r\n        &lt;script&gt;\r\n           window.onload = function () {\r\n                document.getElementById(\"img01\").src = \"File\/img01.png\"\r\n           };\r\n        &lt;\/script&gt;\r\n       &lt;\/head&gt;\r\n    '''\r\n\r\n    # (D)\r\n    t= t + '''\r\n        &lt;body&gt;\r\n            &lt;img id = \"img01\"&gt;\r\n        &lt;\/body&gt;\r\n    '''\r\n    return t\r\n\r\n# \u30b5\u30fc\u30d0\u306e\u8d77\u52d5\uff08\u4e00\u756a\u4e0b\u306b\u66f8\u304f\u3053\u3068\uff09\r\nrun(reloader=True, port=9999)<\/pre>\n<p>\u91cd\u8981\u306a\u3053\u3068\u306f\u3001python\u306b\u5bfe\u3057\u3066\u753b\u50cf\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u3069\u3053\u306b\u7f6e\u3044\u3066\u3042\u308b\u304b\u3092\u6559\u3048\u3066\u3042\u3052\u308b\u3053\u3068\u3067\u3059\u3002(A)\u304a\u3088\u3073(B)\u3067\u305d\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u3001test.py\u304c\u8d77\u52d5\u3057\u3066\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u8d77\u70b9\u3068\u3057\u3066\u3001\u305d\u3053\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30eaFile\u304c\u3042\u308b\u3068\u3057\u3001\u305d\u306e\u4e2d\u306b\u753b\u50cf\u30d5\u30a1\u30a4\u30ebimg01.png\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u3001(A)\u3068(B)\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u30eb\u30fc\u30eb\u3067\u30d1\u30b9\u6307\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><b>(A)\u3067\u6307\u5b9a\u3059\u308b\u30d1\u30b9:<\/b> test.py\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u8d77\u70b9\u3068\u3057\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u3001test.py\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306bFile\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u3042\u308a\u3001\u305d\u3053\u306b\u753b\u50cf\u304c\u3042\u308b\u306e\u3067\u3001(A)\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/li>\n<li><b>(B)\u3067\u6307\u5b9a\u3059\u308b\u30d1\u30b9:<\/b> \u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u30d5\u30eb\u30d1\u30b9\u3068\u3057\u3066\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u753b\u50cf\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u30b3\u30de\u30f3\u30c9\u3067\u300cpwd\u300d\u3068\u6253\u3061\u8fbc\u3081\u3070\u5024\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u305d\u308c\u3067\u306f\u74b0\u5883\u304c\u5909\u308f\u308b\u3068\u4f7f\u3048\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u5c11\u3057\u5de5\u592b\u3057\u307e\u3059\u3002(B)\u306b\u3042\u308b\u3088\u3046\u306b\u3001os.getcwd()\u3068\u66f8\u304f\u3053\u3068\u3067\u3001test.py\u304c\u8d77\u52d5\u3057\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5165\u624b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5f8c\u308d\u306b\u3064\u306a\u3052\u308b\u3053\u3068\u3067\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30d5\u30eb\u30d1\u30b9\u3067\u5165\u624b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3053\u308c\u3067\u3001python\u304c\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u6b21\u306b\u3001html\u3092\u8a18\u8ff0\u3059\u308b\u90e8\u5206\u306b\u79fb\u308a\u307e\u3059\u3002(C)\u3092\u898b\u308b\u3068\u3001document.getElementById(&#8220;img01&#8221;).src = &#8220;File\/img01.png&#8221;\u3068\u3044\u3046\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001id\u306bimg01\u304c\u6307\u5b9a\u3055\u308c\u305fhtml\u30bf\u30b0\u306esrc\u8981\u7d20\u3092&#8221;File\/img01.png&#8221;\u306b\u66f8\u304d\u63db\u3048\u3088\u3001\u3068\u3044\u3046\u610f\u5473\u304c\u3042\u308a\u307e\u3059\u3002id\u306bimg01\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u30bf\u30b0\u306f\u3069\u3053\u304b\u63a2\u3057\u3066\u307f\u308b\u3068\u3001(D)\u306b\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u307e\u3059\u3002\u3059\u306a\u308f\u3061\u3001(C)\u3068(D)\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001<\/p>\n<pre>\r\n\r\n<img decoding=\"async\" id = \"img01\" src=\"File\/img01.png\">\r\n<\/pre>\n<p>\u3068\u306a\u308a\u3001\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u308bHTML\u30bf\u30b0\u304c\u69cb\u6210\u3055\u308c\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<b>\u3044\u304d\u306a\u308a\u3001img\u30bf\u30b0\u306e\u4e2d\u306b\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308c\u3070\u3044\u3044\u306e\u306b\u3001\u306a\u305c(C)\u3092\u7d4c\u7531\u3057\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b\u3002<\/b>\u3053\u308c\u306b\u306f\u7d50\u69cb\u5927\u4e8b\u306a\u7406\u7531\u304c\u3042\u308a\u307e\u3059\u3002(C)\u3092\u307f\u308b\u3068windows.onload\u95a2\u6570\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u3092\u8aad\u307f\u8fbc\u3093\u3060\u5f8c\u306b\u3001onload\u95a2\u6570\u306e\u4e2d\u8eab\u3092\u5b9f\u884c\u3059\u308b\u3001\u3068\u3044\u3046\u610f\u5473\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u304d\u3061\u3093\u3068\u30ed\u30fc\u30c9\u3055\u308c\u305f\u5f8c\u306b\u3001\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3082\u3057\u3001(C)\u3092\u7d4c\u7531\u305b\u305a\u306b\u3001img\u30bf\u30b0\u306b\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u76f4\u66f8\u304d\u3057\u305f\u5834\u5408\u3001\u753b\u50cf\u304c\u8aad\u307f\u8fbc\u307e\u308c\u308b\u524d\u306b\u3001\u753b\u50cf\u304c\u8868\u793a\u3057\u3088\u3046\u3068\u3057\u3066\u3057\u307e\u3044\u3001\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u672c\u756a\u74b0\u5883\u3067Web\u30da\u30fc\u30b8\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u305f\u5834\u5408\u3001\u7279\u306b\u9855\u8457\u306b\u767a\u751f\u3057\u307e\u3059\u3002\u5fc5\u305a\u3001<b>(C)\u3092\u7d4c\u7531\u3057\u3066\u753b\u50cf\u3092\u8868\u793a\u3055\u305b\u308b\u7656<\/b>\u3092\u3064\u3051\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><b>\u8907\u6570\u306e\u753b\u50cf\u3092\u4e26\u3079\u308b\u5834\u5408:<\/b><br \/>\njavascript\u306f\u30bb\u30df\u30b3\u30ed\u30f3\u3067\u6539\u884c\u3092\u8a8d\u8b58\u3059\u308b\u306e\u3067\u3001\u30bb\u30df\u30b3\u30ed\u30f3\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002\u753b\u50cf\u304c1\u679a\u306e\u5834\u5408\u306f\u4e0d\u8981\u3067\u3059\u3002<\/p>\n<pre>\r\n<script>\r\n window.onload = function () {\r\n  document.getElementById(\"img01\").src = \"File\/img01.png\";\r\n  document.getElementById(\"img02\").src = \"File\/img02.png\";\r\n };\r\n<\/script>\r\n<\/pre>\n<p><b>\u30ad\u30e3\u30c3\u30b7\u30e5\u5bfe\u7b56:<\/b><br \/>\n\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3092\u30e6\u30fc\u30b6\u306e\u5165\u529b\u306b\u5f93\u3063\u3066\u751f\u6210\u3055\u305b\u308b\u3088\u3046\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u5834\u5408\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u60aa\u3055\u3092\u3057\u3066\u753b\u50cf\u304c\u66f4\u65b0\u3055\u308c\u306a\u304f\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u300caaa.png?xxx\u300d\u306e\u3088\u3046\u306b\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u306e\u5f8c\u308d\u306b\u7121\u4f5c\u70ba\u306a\u6587\u5b57\u5217xxx\u3092\u5165\u308c\u308b\u3053\u3068\u3067\u3001\u3053\u306e\u5bfe\u7b56\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>\r\n\r\nimport time\r\ncashtx = str(time.time()) # \u73fe\u5728\u6642\u523b\u306e\u6587\u5b57\u5217\u751f\u6210\r\nt = t + '<script>'\r\nt = t + 'window.onload = function () {'\r\nt = t + ' document.getElementById(\"img01\").src = \"File\/img01.png?' + cashtx + '\";'\r\nt = t + ' document.getElementById(\"img02\").src = \"File\/img02.png?' + cashtx + '\";' # <-\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u9589\u3058\u308b\"\u3092\u5fd8\u308c\u305a\u306b\r\nt = t + ' };'\r\nt = t + '<\/script>'\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u3053\u3053\u3067\u306f\u3001\u753b\u50cf\u3084\u52d5\u753b\u306a\u3069\u3001\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u3092Python\u3068bottle\u3092\u7528\u3044\u3066HTML\u4e0a\u306b\u8868\u793a\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001File\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308bimg01.png\u3068\u3044\u3046\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\u3092\u8ff0\u3079\u307e\u3059\u3002 <\/p><\/div>\n<div class=\"blog-btn\"><a href=\"http:\/\/int-info.com\/index.php\/pylearnweb06\/\" class=\"home-blog-btn\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1257","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/comments?post=1257"}],"version-history":[{"count":15,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1257\/revisions"}],"predecessor-version":[{"id":1874,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1257\/revisions\/1874"}],"wp:attachment":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/media?parent=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}