{"id":755,"date":"2025-08-04T09:34:25","date_gmt":"2025-08-04T00:34:25","guid":{"rendered":"https:\/\/nexive.tech\/?p=755"},"modified":"2025-08-04T09:34:25","modified_gmt":"2025-08-04T00:34:25","slug":"%e3%80%90%e3%82%b5%e3%82%af%e3%83%83%e3%81%a8%e8%a7%a3%e8%aa%ac%e3%80%91php-require%e3%81%a8include%e3%81%ae%e9%81%95%e3%81%84%e3%83%bb%e4%bd%bf%e3%81%84%e5%88%86%e3%81%91%e6%96%b9","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=755","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP require\u3068include\u306e\u9055\u3044\u30fb\u4f7f\u3044\u5206\u3051\u65b9"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP\u306e<code>require<\/code>\u3068<code>include<\/code>\u306e\u9055\u3044\u3068\u4f7f\u3044\u5206\u3051\u3092\u89e3\u8aac<\/li>\n\n\n\n<li>\u305d\u308c\u305e\u308c\u306e\u69cb\u6587\u306e\u6319\u52d5\u3068\u3001\u5b9f\u52d9\u4e0a\u306e\u9069\u5207\u306a\u4f7f\u7528\u5834\u9762\u3092\u7d39\u4ecb<\/li>\n\n\n\n<li>\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3084\u4f9d\u5b58\u95a2\u4fc2\u7ba1\u7406\u306e\u89b3\u70b9\u304b\u3089\u6bd4\u8f03<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306erequire\u3068include\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>PHP\u3067\u306f\u3001\u5916\u90e8\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u518d\u5229\u7528\u3059\u308b\u305f\u3081\u306b<code>require<\/code>\u304a\u3088\u3073<code>include<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3069\u3061\u3089\u3082\u3001\u6307\u5b9a\u3055\u308c\u305fPHP\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f\u3001\u8aad\u307f\u8fbc\u307e\u308c\u305f\u5074\u306e\u5185\u5bb9\u3092\u305d\u306e\u5834\u306b\u5c55\u958b\u3059\u308b\u6a5f\u80fd\u3092\u6301\u3061\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e3b\u306a\u7528\u9014\u3068\u3057\u3066\u306f\u3001\u5171\u901a\u95a2\u6570\u7fa4\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u90e8\u54c1\u306a\u3069\u3092\u5206\u5272\u30fb\u518d\u5229\u7528\u3059\u308b\u969b\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u306e\u91cd\u8907\u3092\u907f\u3051\u3001\u4fdd\u5b88\u6027\u3092\u9ad8\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>require<\/code>\u3068<code>include<\/code>\u306f\u69cb\u6587\u3068\u3057\u3066\u306f\u4f3c\u3066\u3044\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u767a\u751f\u6642\u306e\u6319\u52d5\u3084\u4f7f\u7528\u610f\u56f3\u306b\u9055\u3044\u304c\u3042\u308a\u3001\u9069\u5207\u306b\u4f7f\u3044\u5206\u3051\u308b\u3053\u3068\u3067\u3088\u308a\u5805\u7262\u306a\u30b3\u30fc\u30c9\u8a2d\u8a08\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u8a73\u7d30\u89e3\u8aac<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u306b\u5931\u6557\u3057\u305f\u5834\u5408\u306e\u6319\u52d5\u306e\u9055\u3044<\/h3>\n\n\n\n<p>\u307e\u305a\u306f\u3001<code>require<\/code>\u3068<code>include<\/code>\u306e\u57fa\u672c\u7684\u306a\u9055\u3044\u3067\u3042\u308b\u300c\u8aad\u307f\u8fbc\u307f\u5931\u6557\u6642\u306e\u6319\u52d5\u300d\u306b\u6ce8\u76ee\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ include \u306f\u8b66\u544a\uff08Warning\uff09\u3092\u51fa\u3057\u3066\u51e6\u7406\u3092\u7d9a\u884c\u3059\u308b\ninclude 'not_found.php';\necho \"\u51e6\u7406\u304c\u7d9a\u884c\u3055\u308c\u307e\u3057\u305f\\n\";\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ include \u306f\u8b66\u544a\uff08Warning\uff09\u3092\u51fa\u3057\u3066\u51e6\u7406\u3092\u7d9a\u884c\u3059\u308b<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">include<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;not_found.php&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u51e6\u7406\u304c\u7d9a\u884c\u3055\u308c\u307e\u3057\u305f<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u51fa\u529b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>Warning: include(not_found.php): failed to open stream...\n\u51e6\u7406\u304c\u7d9a\u884c\u3055\u308c\u307e\u3057\u305f\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">Warning: <\/span><span style=\"color: #C586C0\">include<\/span><span style=\"color: #D4D4D4\">(not_found<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\">php): failed to open stream...<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u51e6\u7406\u304c\u7d9a\u884c\u3055\u308c\u307e\u3057\u305f<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ require \u306f\u81f4\u547d\u7684\u30a8\u30e9\u30fc\uff08Fatal error\uff09\u3092\u51fa\u3057\u3066\u51e6\u7406\u3092\u505c\u6b62\u3059\u308b\nrequire 'not_found.php';\necho \"\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093\\n\";\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ require \u306f\u81f4\u547d\u7684\u30a8\u30e9\u30fc\uff08Fatal error\uff09\u3092\u51fa\u3057\u3066\u51e6\u7406\u3092\u505c\u6b62\u3059\u308b<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">require<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;not_found.php&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u3053\u306e\u884c\u306f\u5b9f\u884c\u3055\u308c\u307e\u305b\u3093<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u51fa\u529b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>Fatal error: require(): Failed opening required 'not_found.php'...\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">Fatal error: <\/span><span style=\"color: #C586C0\">require<\/span><span style=\"color: #D4D4D4\">(): Failed opening required <\/span><span style=\"color: #CE9178\">&#39;not_found.php&#39;<\/span><span style=\"color: #D4D4D4\">...<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u901a\u5e38\u306e\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ \u5171\u901a\u95a2\u6570\u306a\u3069\u3092\u8aad\u307f\u8fbc\u3080\u5834\u9762\nrequire 'functions.php';\n\n$result = my_function();\necho $result;\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u5171\u901a\u95a2\u6570\u306a\u3069\u3092\u8aad\u307f\u8fbc\u3080\u5834\u9762<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">require<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;functions.php&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$result<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">my_function<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$result<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u81f4\u547d\u7684\u30a8\u30e9\u30fc\u3068\u306a\u308b\u305f\u3081\u3001\u5fc5\u305a\u5b58\u5728\u3059\u3079\u304d\u4f9d\u5b58\u30d5\u30a1\u30a4\u30eb\u306b\u306f<code>require<\/code>\u304c\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\u7684\u306a\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\ninclude 'optional_config.php';\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u30aa\u30d7\u30b7\u30e7\u30f3\u7684\u306a\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">include<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;optional_config.php&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u8aad\u307f\u8fbc\u307f\u306b\u5931\u6557\u3057\u3066\u3082\u7d9a\u884c\u3057\u3066\u3088\u3044\u5834\u5408\uff08\u4f8b\uff1a\u5b58\u5728\u3059\u308c\u3070\u8a2d\u5b9a\u3092\u4e0a\u66f8\u304d\uff09\u306b\u306f<code>include<\/code>\u304c\u9069\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">once\u4ed8\u304d\u306e\u4f7f\u3044\u5206\u3051<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>require_once 'init.php';\ninclude_once 'header.php';\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C586C0\">require_once<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;init.php&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">include_once<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&#39;header.php&#39;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>*_once<\/code>\u7cfb\u306f\u3001\u540c\u3058\u30d5\u30a1\u30a4\u30eb\u304c\u8907\u6570\u56de\u8aad\u307f\u8fbc\u307e\u308c\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u30af\u30e9\u30b9\u5b9a\u7fa9\u3084\u521d\u671f\u5316\u51e6\u7406\u304c\u91cd\u8907\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\u5834\u9762\u3067\u306f\u3001<code>require_once<\/code>\u306e\u4f7f\u7528\u304c\u4e00\u822c\u7684\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u3088\u304f\u3042\u308b\u30df\u30b9\u30fb\u8aa4\u89e3\u30fb\u843d\u3068\u3057\u7a74<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5b58\u5728\u3057\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3092include\u3057\u3066\u6c17\u3065\u304b\u306a\u3044\u307e\u307e\u9032\u884c\u3059\u308b<\/strong>\uff1a\u7279\u306b\u30ed\u30b0\u51fa\u529b\u3084\u753b\u9762\u4e0a\u306b\u8b66\u544a\u3092\u51fa\u3055\u306a\u3044\u8a2d\u5b9a\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u3001\u8aad\u307f\u8fbc\u307f\u5931\u6557\u306b\u6c17\u3065\u3051\u307e\u305b\u3093\u3002<\/li>\n\n\n\n<li><strong>require\u306e\u591a\u7528\u3067\u30a8\u30e9\u30fc\u505c\u6b62\u304c\u983b\u767a\u3059\u308b<\/strong>\uff1a\u958b\u767a\u4e2d\u306b\u4e00\u6642\u7684\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4e0d\u8db3\u3057\u3066\u3044\u308b\u5834\u5408\u306a\u3069\u3001\u9069\u5b9c<code>include<\/code>\u306b\u5207\u308a\u66ff\u3048\u308b\u67d4\u8edf\u6027\u3082\u5fc5\u8981\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong><code>*_once<\/code>\u3092\u4f7f\u308f\u305a\u306b\u5b9a\u7fa9\u306e\u91cd\u8907\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b<\/strong>\uff1a\u5171\u901a\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u8907\u6570\u7b87\u6240\u3067\u8aad\u307f\u8fbc\u3080\u8a2d\u8a08\u3067\u306f<code>require_once<\/code>\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u307e\u305f\u3001\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u306f\u76f8\u5bfe\u30d1\u30b9\/\u7d76\u5bfe\u30d1\u30b9\u306e\u89e3\u6c7a\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<code>__DIR__<\/code>\u3084<code>realpath()<\/code>\u3092\u4f75\u7528\u3057\u3066\u3001\u30d1\u30b9\u306e\u57fa\u6e96\u3092\u660e\u793a\u3059\u308b\u306e\u304c\u5b89\u5168\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>require<\/code>\u306f\u30d5\u30a1\u30a4\u30eb\u304c\u5fc5\u9808\u306e\u5834\u5408\u306b\u4f7f\u7528\u3057\u3001\u8aad\u307f\u8fbc\u307f\u5931\u6557\u3067\u51e6\u7406\u3092\u505c\u6b62\u3057\u307e\u3059<\/li>\n\n\n\n<li><code>include<\/code>\u306f\u4efb\u610f\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u306b\u4f7f\u7528\u3057\u3001\u5931\u6557\u3057\u3066\u3082\u7d9a\u884c\u3057\u307e\u3059<\/li>\n\n\n\n<li>\u91cd\u8907\u8aad\u307f\u8fbc\u307f\u3092\u907f\u3051\u305f\u3044\u5834\u5408\u306f<code>require_once<\/code>\u307e\u305f\u306f<code>include_once<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3059<\/li>\n<\/ul>\n\n\n\n<p>\u4f9d\u5b58\u30d5\u30a1\u30a4\u30eb\u306e\u91cd\u8981\u5ea6\u3084\u5b9f\u884c\u7d99\u7d9a\u306e\u8981\u5426\u306b\u5fdc\u3058\u3066\u3001\u9069\u5207\u306a\u69cb\u6587\u3092\u9078\u3076\u3053\u3068\u304c\u5805\u7262\u306aPHP\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u8a2d\u8a08\u306b\u3064\u306a\u304c\u308a\u307e\u3059<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306erequire\u3068include\u3068\u306f\uff1f PHP\u3067\u306f\u3001\u5916\u90e8\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u518d\u5229\u7528\u3059\u308b\u305f\u3081\u306brequire\u304a\u3088\u3073include\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3069\u3061\u3089\u3082\u3001\u6307\u5b9a\u3055\u308c\u305fPHP\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":560,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=755"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/755\/revisions"}],"predecessor-version":[{"id":764,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/755\/revisions\/764"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/560"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}