{"id":27496,"date":"2024-11-24T13:56:50","date_gmt":"2024-11-24T05:56:50","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27496\/"},"modified":"2024-11-24T13:56:50","modified_gmt":"2024-11-24T05:56:50","slug":"php%e4%b8%ador%e6%98%af%e4%bb%80%e4%b9%88%e6%84%8f%e6%80%9d","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27496\/","title":{"rendered":"php\u4e2dor\u662f\u4ec0\u4e48\u610f\u601d"},"content":{"rendered":"<blockquote><p>\n  php \u4e2d\u7684 or \u8fd0\u7b97\u7b26\u7528\u4e8e\u903b\u8f91 or \u8fd0\u7b97\uff0c\u5f53\u81f3\u5c11\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a true \u65f6\u8fd4\u56de true\uff0c\u5426\u5219\u4e3a false\u3002\u8bed\u6cd5\uff1a$result = $expression1 or $expression2\u3002\u5b83\u5e38\u7528\u4e8e\u68c0\u67e5\u591a\u4e2a\u6761\u4ef6\u3001\u8bbe\u7f6e\u9ed8\u8ba4\u503c\u548c\u521b\u5efa\u590d\u5408\u6761\u4ef6\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/11\/2024111100212886980.jpg\" class=\"aligncenter\" title=\"php\u4e2dor\u662f\u4ec0\u4e48\u610f\u601d\u63d2\u56fe\" alt=\"php\u4e2dor\u662f\u4ec0\u4e48\u610f\u601d\u63d2\u56fe\" \/><\/p>\n<p><strong>PHP \u4e2d\u7684 or \u8fd0\u7b97\u7b26<\/strong><\/p>\n<p>\u5728 PHP \u4e2d\uff0cor \u8fd0\u7b97\u7b26\u7528\u4e8e\u903b\u8f91 OR \u8fd0\u7b97\u3002\u5b83\u5c06\u4e24\u4e2a\u5e03\u5c14\u8868\u8fbe\u5f0f\u8fde\u63a5\u8d77\u6765\uff0c\u8fd4\u56de true \u5982\u679c\u81f3\u5c11\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a true\uff0c\u5426\u5219\u8fd4\u56de false\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>$result = $expression1 or $expression2;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6c42\u503c\u89c4\u5219\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<ul>\n<li>\u5982\u679c\u7b2c\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a true\uff0cor \u8fd0\u7b97\u7b26\u8fd4\u56de true\uff0c\u65e0\u9700\u8bc4\u4f30\u7b2c\u4e8c\u4e2a\u8868\u8fbe\u5f0f\u3002<\/li>\n<li>\u5982\u679c\u7b2c\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a false\uff0cor \u8fd0\u7b97\u7b26\u8bc4\u4f30\u7b2c\u4e8c\u4e2a\u8868\u8fbe\u5f0f\u3002<\/li>\n<li>\u5982\u679c\u7b2c\u4e8c\u4e2a\u8868\u8fbe\u5f0f\u4e3a true\uff0cor \u8fd0\u7b97\u7b26\u8fd4\u56de true\u3002<\/li>\n<li>\u5426\u5219\uff0cor \u8fd0\u7b97\u7b26\u8fd4\u56de false\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>$age = 18;\n$isEligible = ($age &gt;= 18) or ($age &lt;= 100); \/\/ true\n$isEligible = ($age &lt; 18) or ($age &gt; 100); \/\/ false<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528\u573a\u666f\uff1a<\/strong><\/p>\n<p>or \u8fd0\u7b97\u7b26\u5e38\u7528\u4e8e\u4ee5\u4e0b\u573a\u666f\uff1a<\/p>\n<ul>\n<li>\u68c0\u67e5\u591a\u4e2a\u6761\u4ef6\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u662f\u5426\u4e3a true\u3002<\/li>\n<li>\u8bbe\u7f6e\u9ed8\u8ba4\u503c\uff0c\u5982\u679c\u7b2c\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a false\u3002<\/li>\n<li>\u521b\u5efa\u590d\u5408\u6761\u4ef6\uff0c\u5176\u4e2d\u4e00\u4e2a\u8868\u8fbe\u5f0f\u5fc5\u987b\u4e3a true\u3002<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>or \u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7\u8f83\u4f4e\uff0c\u56e0\u6b64\u5b83\u5728 &amp;&amp; \u8fd0\u7b97\u7b26\u4e4b\u524d\u6c42\u503c\u3002<\/li>\n<li>or \u8fd0\u7b97\u7b26\u53ef\u4ee5\u4e0e\u5176\u4ed6\u903b\u8f91\u8fd0\u7b97\u7b26\uff08\u4f8b\u5982 &amp;&amp;\uff09\u7ec4\u5408\u4f7f\u7528\u3002<\/li>\n<li>\u5728 PHP \u4e2d\uff0c|| \u8fd0\u7b97\u7b26\u662f or \u8fd0\u7b97\u7b26\u7684\u540c\u4e49\u8bcd\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fphp\u4e2dor\u662f\u4ec0\u4e48\u610f\u601d\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>php \u4e2d\u7684 or \u8fd0\u7b97\u7b26\u7528\u4e8e\u903b\u8f91 or \u8fd0\u7b97\uff0c\u5f53\u81f3\u5c11\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a true \u65f6\u8fd4\u56de true\uff0c\u5426\u5219\u4e3a false\u3002\u8bed\u6cd5\uff1a$result = $expression1 or $expression2\u3002\u5b83\u5e38\u7528\u4e8e\u68c0\u67e5\u591a\u4e2a\u6761\u4ef6\u3001\u8bbe\u7f6e\u9ed8\u8ba4\u503c\u548c\u521b\u5efa\u590d\u5408\u6761\u4ef6\u3002 PHP \u4e2d\u7684 or \u8fd0\u7b97\u7b26 \u5728 PHP \u4e2d\uff0cor \u8fd0\u7b97\u7b26\u7528\u4e8e\u903b\u8f91 OR \u8fd0\u7b97\u3002\u5b83\u5c06\u4e24\u4e2a\u5e03\u5c14\u8868\u8fbe\u5f0f\u8fde\u63a5\u8d77\u6765\uff0c\u8fd4\u56de true \u5982\u679c\u81f3\u5c11\u6709\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a true\uff0c\u5426\u5219\u8fd4\u56de false\u3002 \u8bed\u6cd5\uff1a $result = $expression1 or $expression2; \u767b\u5f55\u540e\u590d\u5236 \u6c42\u503c\u89c4\u5219\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5982\u679c\u7b2c\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a true\uff0cor \u8fd0\u7b97\u7b26\u8fd4\u56de true\uff0c\u65e0\u9700\u8bc4\u4f30\u7b2c\u4e8c\u4e2a\u8868\u8fbe\u5f0f\u3002 \u5982\u679c\u7b2c\u4e00\u4e2a\u8868\u8fbe\u5f0f\u4e3a false\uff0cor \u8fd0\u7b97\u7b26\u8bc4\u4f30\u7b2c\u4e8c\u4e2a\u8868\u8fbe\u5f0f\u3002 \u5982\u679c\u7b2c\u4e8c\u4e2a\u8868\u8fbe\u5f0f\u4e3a true\uff0cor \u8fd0\u7b97\u7b26\u8fd4\u56de true\u3002 \u5426\u5219\uff0cor \u8fd0\u7b97\u7b26\u8fd4\u56de false\u3002 \u793a\u4f8b\uff1a $age = 18; [&hellip;]<\/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-27496","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27496","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=27496"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27496\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}