【发布时间】:2013-01-07 15:43:49
【问题描述】:
可能重复:
Can I include code into a PHP class?
Include file in array
我有这个 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';
);
}
?>
请问我该怎么做?
【问题讨论】:
-
不,课堂让一切变得不同
-
错过了,你的问题的答案在这里Can I include code into a PHP class?
-
你为什么要尝试这个?你的目标是什么?这看起来越来越像“设计错误”