{"id":52834,"date":"2024-12-03T13:38:52","date_gmt":"2024-12-03T05:38:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52834\/"},"modified":"2024-12-03T13:38:52","modified_gmt":"2024-12-03T05:38:52","slug":"php%e5%a6%82%e4%bd%95%e6%8e%a7%e5%88%b6html%e7%9a%84readonly%e5%b1%9e%e6%80%a7%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52834\/","title":{"rendered":"PHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>PHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f <\/h1>\n<p>\u54c8\u55bd\uff01\u5927\u5bb6\u597d\uff0c\u5f88\u9ad8\u5174\u53c8\u89c1\u9762\u4e86\uff0c\u6211\u662f\u7c73\u4e91\u7684\u4e00\u540d\u4f5c\u8005\uff0c\u4eca\u5929\u7531\u6211\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aPHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f \u300b<\/span>\uff0c\u672c\u6587\u4e3b\u8981\u4f1a\u8bb2\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u5927\u5bb6\u4e00\u8d77\u5b66\u4e60\u8fdb\u6b65\uff0c\u4e5f\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u3001\u70b9\u8d5e\u3001\u6536\u85cf\u3001\u8f6c\u53d1! \u4e0b\u9762\u5c31\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/17323621976741bfd51ce16.jpg\" class=\"aligncenter\" title=\"PHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f\u63d2\u56fe\" alt=\"PHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>readOnly\u5c5e\u6027\u53ea\u53d7JS\u63a7\u5236\uff1f<\/strong><\/p>\n<p>\u5728HTML\u4e2d\uff0creadOnly\u5c5e\u6027\u63a7\u5236\u8f93\u5165\u5b57\u6bb5\u662f\u5426\u53ef\u7f16\u8f91\u3002\u7136\u800c\uff0c\u4e0a\u8ff0\u4ee3\u7801\u8bd5\u56fe\u4f7f\u7528PHP\u63a7\u5236readOnly\u7684\u503c\uff0c\u5374\u672a\u80fd\u751f\u6548\u3002<\/p>\n<p>\u8981\u6b63\u786e\u4f7f\u7528readOnly\u5c5e\u6027\uff0c\u60a8\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u89c4\u5219\uff1a<\/p>\n<ol>\n<li><strong>readOnly\u53ea\u80fd\u53d6\u4e24\u4e2a\u503c\uff1a<\/strong>\u7a7a\u5b57\u7b26\u4e32\uff08\u53ef\u7f16\u8f91\uff09\u6216&#8221;readOnly&#8221;\uff08\u4e0d\u53ef\u7f16\u8f91\uff09\u3002<\/li>\n<li><strong>PHP\u4e2d\u7684\u771f\u5047\u503c\u4e0d\u9002\u7528\u4e8ereadOnly\uff1a<\/strong>\u4e0d\u7ba1PHP\u4e2dreadOnly\u7684\u503c\u4e3a\u4f55\uff0c\u8f93\u5165\u5b57\u6bb5\u90fd\u4f1a\u88ab\u89c6\u4e3a\u4e0d\u53ef\u7f16\u8f91\u3002<\/li>\n<\/ol>\n<p>\u56e0\u6b64\uff0c\u4e0a\u8ff0\u4ee3\u7801\u5e94\u8fdb\u884c\u4ee5\u4e0b\u4fee\u6539\uff1a<\/p>\n<pre>&lt;input type=\"text\" value=\"&lt;?php echo $_GET['userName'] ?? ''; ?&gt;\" &lt;?php print(isset($_GET['userName']) ? 'readonly':''); ?&gt;&gt;<\/pre>\n<p>\u73b0\u5728\uff0creadOnly\u5c5e\u6027\u5c06\u6839\u636e$_GET[&#8216;userName&#8217;]\u7684\u5b58\u5728\u4e0e\u5426\u6765\u8bbe\u7f6e\uff0c\u6709\u6548\u5730\u63a7\u5236\u8f93\u5165\u5b57\u6bb5\u7684\u53ef\u7f16\u8f91\u6027\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aPHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f \u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u5982\u4f55\u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u7684\u672c\u5730\u673a\u5668\u8def\u5f84\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f \u54c8\u55bd\uff01\u5927\u5bb6\u597d\uff0c\u5f88\u9ad8\u5174\u53c8\u89c1\u9762\u4e86\uff0c\u6211\u662f\u7c73\u4e91\u7684\u4e00\u540d\u4f5c\u8005\uff0c\u4eca\u5929\u7531\u6211\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\u300aPHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f \u300b\uff0c\u672c\u6587\u4e3b\u8981\u4f1a\u8bb2\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u5927\u5bb6\u4e00\u8d77\u5b66\u4e60\u8fdb\u6b65\uff0c\u4e5f\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u3001\u70b9\u8d5e\u3001\u6536\u85cf\u3001\u8f6c\u53d1! \u4e0b\u9762\u5c31\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01 readOnly\u5c5e\u6027\u53ea\u53d7JS\u63a7\u5236\uff1f \u5728HTML\u4e2d\uff0creadOnly\u5c5e\u6027\u63a7\u5236\u8f93\u5165\u5b57\u6bb5\u662f\u5426\u53ef\u7f16\u8f91\u3002\u7136\u800c\uff0c\u4e0a\u8ff0\u4ee3\u7801\u8bd5\u56fe\u4f7f\u7528PHP\u63a7\u5236readOnly\u7684\u503c\uff0c\u5374\u672a\u80fd\u751f\u6548\u3002 \u8981\u6b63\u786e\u4f7f\u7528readOnly\u5c5e\u6027\uff0c\u60a8\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u89c4\u5219\uff1a readOnly\u53ea\u80fd\u53d6\u4e24\u4e2a\u503c\uff1a\u7a7a\u5b57\u7b26\u4e32\uff08\u53ef\u7f16\u8f91\uff09\u6216&#8221;readOnly&#8221;\uff08\u4e0d\u53ef\u7f16\u8f91\uff09\u3002 PHP\u4e2d\u7684\u771f\u5047\u503c\u4e0d\u9002\u7528\u4e8ereadOnly\uff1a\u4e0d\u7ba1PHP\u4e2dreadOnly\u7684\u503c\u4e3a\u4f55\uff0c\u8f93\u5165\u5b57\u6bb5\u90fd\u4f1a\u88ab\u89c6\u4e3a\u4e0d\u53ef\u7f16\u8f91\u3002 \u56e0\u6b64\uff0c\u4e0a\u8ff0\u4ee3\u7801\u5e94\u8fdb\u884c\u4ee5\u4e0b\u4fee\u6539\uff1a &lt;input type=&#8221;text&#8221; value=&#8221;&lt;?php echo $_GET[&#8216;userName&#8217;] ?? &#8221;; ?&gt;&#8221; &lt;?php print(isset($_GET[&#8216;userName&#8217;]) ? &#8216;readonly&#8217;:&#8221;); ?&gt;&gt; \u73b0\u5728\uff0creadOnly\u5c5e\u6027\u5c06\u6839\u636e$_GET[&#8216;userName&#8217;]\u7684\u5b58\u5728\u4e0e\u5426\u6765\u8bbe\u7f6e\uff0c\u6709\u6548\u5730\u63a7\u5236\u8f93\u5165\u5b57\u6bb5\u7684\u53ef\u7f16\u8f91\u6027\u3002 \u4ee5\u4e0a\u5c31\u662f\u300aPHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f \u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01 \u5982\u4f55\u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u7684\u672c\u5730\u673a\u5668\u8def\u5f84\uff1f<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52834","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52834"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52834\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}