{"id":2485,"date":"2024-11-10T10:34:13","date_gmt":"2024-11-10T02:34:13","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2485\/"},"modified":"2024-11-10T10:34:13","modified_gmt":"2024-11-10T02:34:13","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","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/2485\/","title":{"rendered":"PHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173077524344154.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> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fPHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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; \u767b\u5f55\u540e\u590d\u5236 \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 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4ee5\u4e0a\u5c31\u662fPHP\u5982\u4f55\u63a7\u5236HTML\u7684readOnly\u5c5e\u6027\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-2485","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2485","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=2485"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2485\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}