{"id":30808,"date":"2023-09-01T17:55:25","date_gmt":"2024-02-21T11:58:27","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/"},"modified":"2025-08-12T20:54:36","modified_gmt":"2025-08-12T12:54:36","slug":"%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/","title":{"rendered":"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df"},"content":{"rendered":"<p>\u636e\u8bf4\uff0c\u5373\u4f7f\u5728PHP\u7684\u63a7\u5236\u7ed3\u6784\uff08\u5982if\u7b49\uff09\u4e2d\uff0c\u53d8\u91cf\u7684\u8303\u56f4\uff08\u53d8\u91cf\u53ef\u4ee5\u4f7f\u7528\u7684\u533a\u57df\uff09\u4e5f\u4e0d\u4f1a\u53d7\u5230\u9650\u5236\u3002<br \/>\n\u5982\u679c\u60f3\u8981\u7f29\u5c0f\u4f5c\u7528\u57df\uff0c\u53ef\u4ee5\u5728\u51fd\u6570\u6216\u65b9\u6cd5\u4e2d\u8fdb\u884c\u5b9a\u4e49\u3002<br \/>\n\u5728JavaScript\u4e2d\uff0c\u8fd9\u65b9\u9762\u7684\u60c5\u51b5\u4e5f\u7c7b\u4f3c\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"cp\">&lt;?php<\/span>\r\n\r\n<span class=\"nv\">$global<\/span> <span class=\"o\">=<\/span> <span class=\"s1\">'global'<\/span><span class=\"p\">;<\/span>\r\n\r\n<span class=\"k\">if<\/span> <span class=\"p\">(<\/span><span class=\"o\">!<\/span> <span class=\"nb\">empty<\/span><span class=\"p\">(<\/span><span class=\"nv\">$global<\/span><span class=\"p\">))<\/span> <span class=\"p\">{<\/span>\r\n    <span class=\"c1\">\/\/ $global\u306f\u3069\u3053\u304b\u3089\u3067\u3082\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b<\/span>\r\n    <span class=\"nv\">$global<\/span> <span class=\"o\">=<\/span> <span class=\"s1\">'globaltest\uff01\uff01'<\/span><span class=\"p\">;<\/span>\r\n<span class=\"p\">}<\/span>\r\n\r\n<span class=\"k\">function<\/span> <span class=\"n\">local<\/span> <span class=\"p\">()<\/span> <span class=\"p\">{<\/span>\r\n    <span class=\"c1\">\/\/ \u95a2\u6570\u3084\u30e1\u30bd\u30c3\u30c9\u5185\u3067\u5b9a\u7fa9\u3059\u308b\u3068\u3053\u306e\u30d6\u30ed\u30c3\u30af\u306e\u5916\u3067\u306f\u4f7f\u3048\u306a\u3044\u3002<\/span>\r\n    <span class=\"nv\">$local<\/span> <span class=\"o\">=<\/span> <span class=\"s1\">'local'<\/span><span class=\"p\">;<\/span>\r\n<span class=\"p\">}<\/span>\r\n\r\n<span class=\"c1\">\/\/ \u4f7f\u3048\u308b\u3000globaltest\uff01\uff01<\/span>\r\n<span class=\"k\">echo<\/span> <span class=\"nv\">$global<\/span><span class=\"p\">;<\/span>\r\n\r\n<span class=\"c1\">\/\/ Notice: Undefined variable:<\/span>\r\n<span class=\"k\">echo<\/span> <span class=\"nv\">$local<\/span><span class=\"p\">;<\/span>\r\n\r\n<\/code><\/pre>\n<p>\u5927\u7ea6\u4e00\u5e74\u524d\u6211\u4e0d\u660e\u767d\u672c\u5730\u7684\u597d\u5904\uff0c\u4f46\u73b0\u5728\u6211\u660e\u767d\u4e86\u3002\u8fd9\u662f\u56e0\u4e3a\u5728\u6211\u5b8c\u5168\u4e0d\u8bb0\u5f97\u5b9a\u4e49\u53d8\u91cf\u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u51fa\u73b0\u9519\u8bef\u3002<\/p>\n<p>\u6211\u8bfb\u4e86\u300a\u5b8c\u7f8ePHP\u300b\uff0c\u611f\u53d7\u9887\u591a\uff0c\u8bd5\u7740\u8fdb\u884c\u8f93\u51fa\u3002<\/p>\n<p>\u53c2\u8003\u6587\u732e<br \/>\n\u300a\u5b8c\u5168PHP\u300b<br \/>\n\u4f5c\u8005: \u5c0f\u5ddd\u96c4\u5927, \u67c4\u6ca2\u8061\u592a\u90ce, \u6a4b\u53e3\u8aa0<br \/>\n\u51fa\u7248\u793e: \u6280\u8853\u8a55\u8ad6\u793e (2010\/11\/12)<br \/>\n<iframe loading=\"lazy\" title=\"\u30d1\u30fc\u30d5\u30a7\u30af\u30c8PHP (PERFECT SERIES 3)\" type=\"text\/html\" width=\"500\" height=\"550\" frameborder=\"0\" allowfullscreen style=\"max-width:100%\" src=\"https:\/\/read.amazon.com.au\/kp\/card?preview=inline&#038;linkCode=kpd&#038;ref_=k4w_oembed_n8f95ZtCvtjHcR&#038;asin=4774144371&#038;tag=kpembed-20\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u636e\u8bf4\uff0c\u5373\u4f7f\u5728PHP\u7684\u63a7\u5236\u7ed3\u6784\uff08\u5982if\u7b49\uff09\u4e2d\uff0c\u53d8\u91cf\u7684\u8303\u56f4\uff08\u53d8\u91cf\u53ef\u4ee5\u4f7f\u7528\u7684\u533a\u57df\uff09\u4e5f\u4e0d\u4f1a\u53d7\u5230\u9650\u5236\u3002 \u5982\u679c\u60f3\u8981\u7f29\u5c0f\u4f5c\u7528 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-30808","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5173\u4e8ephp\u53d8\u91cf\u7684\u4f5c\u7528\u57df\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5173\u4e8ephp\u53d8\u91cf\u7684\u4f5c\u7528\u57df\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-21T11:58:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T12:54:36+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/\",\"name\":\"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2024-02-21T11:58:27+00:00\",\"dateModified\":\"2025-08-12T12:54:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"description\":\"\u5173\u4e8e\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df - Blog - Silicon Cloud","description":"\u5173\u4e8e\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5173\u4e8ephp\u53d8\u91cf\u7684\u4f5c\u7528\u57df\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df","og_description":"\u5173\u4e8e\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5173\u4e8ephp\u53d8\u91cf\u7684\u4f5c\u7528\u57df\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-02-21T11:58:27+00:00","article_modified_time":"2025-08-12T12:54:36+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/","name":"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2024-02-21T11:58:27+00:00","dateModified":"2025-08-12T12:54:36+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"description":"\u5173\u4e8e\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5173\u4e8ePHP\u53d8\u91cf\u7684\u4f5c\u7528\u57df"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8ephp%e5%8f%98%e9%87%8f%e7%9a%84%e4%bd%9c%e7%94%a8%e5%9f%9f\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=30808"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30808\/revisions"}],"predecessor-version":[{"id":94301,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30808\/revisions\/94301"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=30808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=30808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=30808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}