假設index.php如下所示:
namespace testing;
include __DIR__ . 'anotherFile.php'
我的問題是anotherFile.php繼承命名空間namespace testing;嗎?
uj5u.com熱心網友回復:
包含在 include 或 require 中的 php 檔案不會從外部繼承任何命名空間。如果在此檔案中定義了命名空間,則適用。如果沒有定義命名空間,則檔案在全域命名空間中作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/524372.html
標籤:php命名空间
