
{"id":3942,"date":"2020-07-16T16:34:19","date_gmt":"2020-07-16T08:34:19","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=3942"},"modified":"2020-07-16T16:34:19","modified_gmt":"2020-07-16T08:34:19","slug":"%e5%b0%81%e8%a3%9d-encapsulation","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=3942","title":{"rendered":"[ PHP ] &#8211; OOP 11 \u5c01\u88dd Encapsulation"},"content":{"rendered":"<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div><div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div>\n<p>\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002<\/p>\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">\nclass ck {\n\tprivate $budget;\/\/\u9810\u7b97\n  \tprivate $buy_status = false;\/\/\u83dc\u8cb7\u4e86\u55ce\uff1f\n  \tprivate $preapare_status = false;\/\/\u5099\u597d\u83dc\u4e86\u55ce\uff1f\n  \tprivate $cooking_tatus = false;\/\/\u716e\u597d\u83dc\u4e86\u55ce\uff1f\n  \tprivate function buy(){ \/\/\u6700\u5c11\u8981\u6709500\u584a\u624d\u5920\u8cb7\u83dc\n\t\treturn $this->buy_status = $this->budget > 500 ? true : false;\n\t}\n\tprivate function preapare(){ \/\/\u5099\u6599 \u8981\u5148\u8cb7\u597d\u83dc\u624d\u80fd\u5920\u6d17\u83dc \u5207\u83dc \u505a\u5099\u6599\u7684\u52d5\u4f5c\n\t\treturn $this->preapare_status = $this->buy_status ? true : false;\n\t}\n\tprivate function cooking(){ \/\/\u716e\u98ef \u8981\u5148\u5099\u6599\u597d\u624d\u80fd\u5920\u716e\n\t\treturn $this->cooking_tatus = $this->preapare_status ? true : false;\n\t}\n\tpublic function serve($budget){ \/\/\u4e0a\u83dc \u4f60\u53ea\u80fd\u547c\u53eb\u9019\u500b \u56e0\u70ba\u5b83\u662f\u516c\u958b\u7684\u65b9\u6cd5 \u5176\u5b83\u7684\u90fd\u4e0d\u5141\u8a31 \u5728\u985e\u5225\u4e4b\u5916\u547c\u53eb \u9054\u5230\u4fdd\u8b77\u8cc7\u6599\u78ba\u4fdd\u6d41\u7a0b\u6b63\u78ba\n\t\t$this->budget = $budget;\n\t\techo '&lt;br>'.( $this->buy() ? '\u8cb7\u597d\u83dc\u4e86' : '\u4e0d\u5920\u9322');\n\t\techo '&lt;br>'.( $this->preapare() ? '\u5099\u597d\u83dc\u4e86' : '\u9084\u6c92\u8cb7\u83dc');\n\t\techo '&lt;br>'.( $this->cooking() ? '\u716e\u597d\u83dc\u4e86' : '\u9084\u6c92\u5099\u83dc');\n\t\techo '&lt;br>'.( $this->cooking_tatus ? '\u4e0a\u83dc\u56c9\uff01' : '\u9084\u6c92\u716e\u597d\u54e6\uff01');\n\t}\n}\n\/\/\u5c01\u88dd\u7684\u597d\u8655 \u4e0a\u83dc\u7684\u9806\u5e8f \u62ff\u9322 \u8cb7\u83dc \u5099\u83dc \u716e\u83dc \u6700\u5f8c\u624d\u80fd\u4e0a\u83dc\n$c = new ck();\n$c->serve(600);\/\/\u6211\u5011\u53ea\u8981\u547c\u53eb\u4e0a\u83dc \u8ddf \u7d66\u9322 \u524d\u7f6e\u4f5c\u696d\u7684\u7d30\u7bc0\u8ddf\u6d41\u7a0b\u4e0d\u7528\u7ba1\u4ed6\uff0c\u5361\u5728\u90a3\u500b\u968e\u6bb5\u4e5f\u6703\u8ddf\u4f60\u8aaa\u660e\necho '&lt;br>';\nclass ck1 { \/\/ \u6211\u5011\u628a\u6240\u6709\u7684\u5c6c\u6027\u65b9\u6cd5\u90fd\u8a2d\u516c\u958b\n\tpublic $budget;\/\/\u9810\u7b97\n  \tpublic $buy_status = false;\/\/\u83dc\u8cb7\u4e86\u55ce\uff1f\n  \tpublic $preapare_status = false;\/\/\u5099\u597d\u83dc\u4e86\u55ce\uff1f\n  \tpublic $cooking_tatus = false;\/\/\u716e\u597d\u83dc\u4e86\u55ce\uff1f\n  \tpublic function buy(){ \/\/\u6700\u5c11\u8981\u6709500\u584a\u624d\u5920\u8cb7\u83dc\n\t\treturn $this->buy_status = $this->budget > 500 ? true : false;\n\t}\n\tpublic function preapare(){ \/\/\u5099\u6599 \u8981\u5148\u8cb7\u597d\u83dc\u624d\u80fd\u5920\u6d17\u83dc \u5207\u83dc \u505a\u5099\u6599\u7684\u52d5\u4f5c\n\t\treturn $this->preapare_status = $this->buy_status ? true : false;\n\t}\n\tpublic function cooking(){ \/\/\u716e\u98ef \u8981\u5148\u5099\u6599\u597d\u624d\u80fd\u5920\u716e\n\t\treturn $this->cooking_tatus = $this->preapare_status ? true : false;\n\t}\n\tpublic function serve(){ \/\/\u4e0a\u83dc\n\t\techo '&lt;br>'.( $this->cooking_tatus ? '\u4e0a\u83dc\u56c9\uff01' : '\u9084\u6c92\u716e\u597d\u54e6\uff01');\n\t}\n}\n$a = new ck1();\/\/\u4f60\u5c31\u8981\u8f9b\u82e6\u7684\u81ea\u5df2 \u4e00\u500b\u4e00\u500b\u7d66\u503c \u7136\u5f8c\u7167\u9806\u5e8f\u7684\u547c\u53eb\u65b9\u6cd5 \u4e0d\u7136\u4f60\u6c38\u9060\u5403\u4e0d\u4e86\u98ef\n$a->budget=600;\n$a->buy();\n$a->preapare();\n$a->cooking();\n$a->serve();\necho '&lt;br>';\n$b = new ck1();\n$b->budget=600;\n$b->preapare();\/\/\u600e\u9ebc\u9084\u6c92\u8cb7\u83dc\u5c31\u5148\u5099\u83dc\uff1f\n$b->buy();\n$b->cooking();\n$b->serve();\/\/\u770b\u5427\uff01\u4f60\u6c38\u9060\u4e5f\u5403\u4e0d\u4e86\u98ef\u4e86\n\/\/\u986f\u793a\u7d50\u679c\n\/*\n\u8cb7\u597d\u83dc\u4e86\n\u5099\u597d\u83dc\u4e86\n\u716e\u597d\u83dc\u4e86\n\u4e0a\u83dc\u56c9\uff01\n\u4e0a\u83dc\u56c9\uff01\n\u9084\u6c92\u716e\u597d\u54e6\uff01\n*\/<\/pre>\n<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p>\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002<\/p>\n","protected":false},"author":1,"featured_media":2201,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","footnotes":""},"categories":[48,36],"tags":[238,429,448,806],"class_list":["post-3942","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oop","category-php","tag-encapsulation","tag-oop","tag-php","tag-806"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[ PHP ] - OOP 11 \u5c01\u88dd Encapsulation - \u6df7\u6c34\u6478\u9b5a<\/title>\n<meta name=\"description\" content=\"\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002\" \/>\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.webteach.tw\/?p=3942\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[ PHP ] - OOP 11 \u5c01\u88dd Encapsulation - \u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"og:description\" content=\"\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webteach.tw\/?p=3942\" \/>\n<meta property=\"og:site_name\" content=\"\u6df7\u6c34\u6478\u9b5a\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-16T08:34:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webteach.tw\/wp-content\/uploads\/2017\/12\/1-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"680\" \/>\n\t<meta property=\"og:image:height\" content=\"454\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"jeff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"jeff\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942\"},\"author\":{\"name\":\"jeff\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"headline\":\"[ PHP ] &#8211; OOP 11 \u5c01\u88dd Encapsulation\",\"datePublished\":\"2020-07-16T08:34:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942\"},\"wordCount\":5,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2017\\\/12\\\/1-1.png\",\"keywords\":[\"Encapsulation\",\"oop\",\"php\",\"\u5c01\u88dd\"],\"articleSection\":[\"OOP\",\"PHP\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942\",\"name\":\"[ PHP ] - OOP 11 \u5c01\u88dd Encapsulation - \u6df7\u6c34\u6478\u9b5a\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2017\\\/12\\\/1-1.png\",\"datePublished\":\"2020-07-16T08:34:19+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\"},\"description\":\"\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.webteach.tw\\\/?p=3942\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#primaryimage\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2017\\\/12\\\/1-1.png\",\"contentUrl\":\"https:\\\/\\\/www.webteach.tw\\\/wp-content\\\/uploads\\\/2017\\\/12\\\/1-1.png\",\"width\":680,\"height\":454,\"caption\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/?p=3942#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\\\/\\\/www.webteach.tw\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[ PHP ] &#8211; OOP 11 \u5c01\u88dd Encapsulation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#website\",\"url\":\"https:\\\/\\\/www.webteach.tw\\\/\",\"name\":\"\u6df7\u6c34\u6478\u9b5a\",\"description\":\"\u5b78\u7121\u6b62\u5883,\u6559\u5b78\u76f8\u9577\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.webteach.tw\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.webteach.tw\\\/#\\\/schema\\\/person\\\/d434d754fd581338113eecfa923d7520\",\"name\":\"jeff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g\",\"caption\":\"jeff\"},\"sameAs\":[\"http:\\\/\\\/35.72.55.111\"],\"url\":\"https:\\\/\\\/www.webteach.tw\\\/?author=1\"},false]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[ PHP ] - OOP 11 \u5c01\u88dd Encapsulation - \u6df7\u6c34\u6478\u9b5a","description":"\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002","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.webteach.tw\/?p=3942","og_locale":"zh_TW","og_type":"article","og_title":"[ PHP ] - OOP 11 \u5c01\u88dd Encapsulation - \u6df7\u6c34\u6478\u9b5a","og_description":"\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002","og_url":"https:\/\/www.webteach.tw\/?p=3942","og_site_name":"\u6df7\u6c34\u6478\u9b5a","article_published_time":"2020-07-16T08:34:19+00:00","og_image":[{"width":680,"height":454,"url":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2017\/12\/1-1.png","type":"image\/png"}],"author":"jeff","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005:":"jeff","\u9810\u4f30\u95b1\u8b80\u6642\u9593":"1 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webteach.tw\/?p=3942#article","isPartOf":{"@id":"https:\/\/www.webteach.tw\/?p=3942"},"author":{"name":"jeff","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"headline":"[ PHP ] &#8211; OOP 11 \u5c01\u88dd Encapsulation","datePublished":"2020-07-16T08:34:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webteach.tw\/?p=3942"},"wordCount":5,"commentCount":0,"image":{"@id":"https:\/\/www.webteach.tw\/?p=3942#primaryimage"},"thumbnailUrl":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2017\/12\/1-1.png","keywords":["Encapsulation","oop","php","\u5c01\u88dd"],"articleSection":["OOP","PHP"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webteach.tw\/?p=3942#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webteach.tw\/?p=3942","url":"https:\/\/www.webteach.tw\/?p=3942","name":"[ PHP ] - OOP 11 \u5c01\u88dd Encapsulation - \u6df7\u6c34\u6478\u9b5a","isPartOf":{"@id":"https:\/\/www.webteach.tw\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webteach.tw\/?p=3942#primaryimage"},"image":{"@id":"https:\/\/www.webteach.tw\/?p=3942#primaryimage"},"thumbnailUrl":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2017\/12\/1-1.png","datePublished":"2020-07-16T08:34:19+00:00","author":{"@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520"},"description":"\u7269\u4ef6\u5c0e\u5411\u7684\u4e00\u5927\u7279\u6027\u5c31\u662f \u5c01\u88dd Encapsulation \uff0c\u4f60\u53ea\u8981\u751f\u6210\u985e\u5225 \u7136\u5f8c \u50b3\u53c3\u6578\uff0c\u4e4b\u5f8c\u5c31\u7b49\u98ef\u5403\u5c31\u597d\u4e86\uff0c\u7d30\u7bc0\u5c31\u4ea4\u7d66\u5225\u4eba\u53bb\u505a\u5427\uff0c\u7701\u4e8b\u53c8\u4e0d\u6703\u5bb9\u6613\u51fa\u932f\u3002","breadcrumb":{"@id":"https:\/\/www.webteach.tw\/?p=3942#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webteach.tw\/?p=3942"]}]},{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/www.webteach.tw\/?p=3942#primaryimage","url":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2017\/12\/1-1.png","contentUrl":"https:\/\/www.webteach.tw\/wp-content\/uploads\/2017\/12\/1-1.png","width":680,"height":454,"caption":""},{"@type":"BreadcrumbList","@id":"https:\/\/www.webteach.tw\/?p=3942#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/www.webteach.tw\/"},{"@type":"ListItem","position":2,"name":"[ PHP ] &#8211; OOP 11 \u5c01\u88dd Encapsulation"}]},{"@type":"WebSite","@id":"https:\/\/www.webteach.tw\/#website","url":"https:\/\/www.webteach.tw\/","name":"\u6df7\u6c34\u6478\u9b5a","description":"\u5b78\u7121\u6b62\u5883,\u6559\u5b78\u76f8\u9577","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webteach.tw\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":"Person","@id":"https:\/\/www.webteach.tw\/#\/schema\/person\/d434d754fd581338113eecfa923d7520","name":"jeff","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5797200e421b670a2ce64d6e7382054c69b231d4aab55742c96bb1e51bc9fefc?s=96&d=mm&r=g","caption":"jeff"},"sameAs":["http:\/\/35.72.55.111"],"url":"https:\/\/www.webteach.tw\/?author=1"},false]}},"views":647,"yasr_visitor_votes":{"stars_attributes":{"read_only":false,"span_bottom":false},"number_of_votes":0,"sum_votes":0},"_links":{"self":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/3942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3942"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/3942\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/media\/2201"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}