可能重复:
我可以在 PHP 类中包含代码吗?
在数组中包含文件
我有这个 php 代码
<?php
class Config {
public static $__routes = array(
"Home" => "index.php",
"Support" => "support.php",
"Ads" => "ads.php",
);
}
?>
我有这样的 ex.php 文件
"Upgrade" => "upgrade.php",
"Faq" => "faq.php",
"Tos" => "tos.php",
我想将 ex.php 文件包含在“类”中的“公共静态 $__routes 数组”中
有点像
<?php
class Config {
public static $__routes = array(
"Home" => "index.php",
"Support" => "support.php",
"Ads" => "ads.php",
include 'ex.php';
);
}
?>
请问我该怎么做?